public static function getInstance()
 {
     if (!self::$_instance) {
         self::$_instance = new CPM_Notification();
     }
     return self::$_instance;
 }
Ejemplo n.º 2
0
 function mark_task_complete()
 {
     check_ajax_referer('cpm_nonce');
     $posted = $_POST;
     $task_id = (int) $posted['task_id'];
     $list_id = $posted['list_id'];
     $project_id = $posted['project_id'];
     $single = (int) $posted['single'];
     $task_obj = CPM_Task::getInstance();
     $task_obj->mark_complete($task_id);
     $complete = $task_obj->get_completeness($list_id, $project_id);
     $task = $task_obj->get_task($task_id);
     $response = array('success' => true, 'content' => cpm_task_html($task, $project_id, $list_id, $single), 'progress' => cpm_task_completeness($complete['total'], $complete['completed']));
     $response = apply_filters('cpm_task_complete_response', $response, $task_id, $list_id, $project_id);
     CPM_Notification::getInstance()->complete_task($list_id, $task_id, $task, $project_id);
     echo json_encode($response);
     exit;
 }
Ejemplo n.º 3
0
 /**
  * Instantiate all the required classes
  *
  * @since 0.1
  */
 function instantiate()
 {
     $this->project = CPM_Project::getInstance();
     $this->message = CPM_Message::getInstance();
     $this->task = CPM_Task::getInstance();
     $this->milestone = CPM_Milestone::getInstance();
     $this->activity = CPM_Activity::getInstance();
     $this->ajax = CPM_Ajax::getInstance();
     $this->notification = CPM_Notification::getInstance();
     if (function_exists('json_api_init')) {
         $this->api = CPM_API::instance();
     }
     // instantiate admin settings only on admin page
     if (is_admin()) {
         $this->admin = new CPM_Admin();
         $this->upgrade = new CPM_Upgrade();
     }
     do_action('cpm_instantiate', $this);
 }