You are here

function appointment_calendar_delete_template_page in Appointment Calendar 7

Implements function to delete template that copied in theme folders.

1 call to appointment_calendar_delete_template_page()
appointment_calendar_uninstall in ./appointment_calendar.install
Implements hook_unistall().

File

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

Code

function appointment_calendar_delete_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);
    $destination = $path . '/templates/page--appointcal.tpl.php';
    if (file_exists($destination)) {
      file_unmanaged_delete($destination);
    }
  }
}