You are here

function appointment_calendar_add_template_page in Appointment Calendar 7

Implements function to copy template in themes that are enabled.

1 call to appointment_calendar_add_template_page()
appointment_calendar_install in ./appointment_calendar.install
Implements hook_install().

File

./appointment_calendar.install, line 180
Install and uninstall functions for the Appointment Calendar module.

Code

function appointment_calendar_add_template_page() {
  $query = db_select('system', 'sy');
  $query
    ->fields('sy', array(
    'name',
  ));
  $query
    ->condition('status', 1);
  $query
    ->condition('type', 'theme', '=');
  $query
    ->condition('name', array(
    'seven',
    'garland',
    'engine',
  ), 'NOT IN');
  $result = $query
    ->execute()
    ->fetchAll(PDO::FETCH_ASSOC);
  foreach ($result as $res) {
    $path = drupal_get_path('theme', $res['name']);
    chmod($path, 0777);
    if (file_prepare_directory($path)) {
      $source = drupal_get_path('module', 'appointment_calendar') . '/templates/page--appointcal.tpl.php';
      $destination = $path . '/templates/page--appointcal.tpl.php';
      file_unmanaged_copy($source, $destination);
    }
  }
}