예제 #1
0
파일: item.php 프로젝트: tomzt/tfwp
 /**
  * set task status
  * @param number $status status code
  * @param number $uid (optional) id of the user setting the status
  * @param string $info (optional) may contain "creation" for example 
  * @return boolean
  */
 public function set_status($status, $uid = null, $info = null)
 {
     if (is_null($uid)) {
         $uid = get_current_user_id();
     }
     $obj = new tfk_item_status();
     $obj->set('item_id', $this->get_uid());
     $obj->set('log_date', 'NOW');
     $obj->set('action_code', $status);
     $obj->set_object('user', $uid);
     if (!is_null($info)) {
         $obj->set('info', $info);
     }
     return $obj->insert('ignore');
 }
예제 #2
0
파일: task_edit.php 프로젝트: tomzt/tfwp
if ($this->pid != 0 && get_current_user_id() != $this->data->get('author_id') && !$this->data->get('project')->check_access('manage')) {
    // or must be a manager of the project
    echo '<p class="tfk_err">' . __("Sorry, you can't edit this task. Please contact an admin.", 'taskfreak') . '</p>';
    return;
}
// --- SUBMIT ---------------------------
if (isset($_POST['edit'])) {
    // Submit data, check and save
    // we have to do this because of http://codex.wordpress.org/Function_Reference/stripslashes_deep#Notes
    $_POST = stripslashes_deep($_POST);
    if ($this->pid) {
        // prepare log info (if data check fails, it won't be saved)
        $update_log = new tfk_item_status();
        $update_log->set('log_date', 'NOW');
        $update_log->set('item_id', $this->pid);
        $update_log->set_object('user', get_current_user_id());
        $update_log_info = array();
        foreach (array('title', 'priority', 'user_id', 'description') as $prop) {
            if (!empty($_POST[$prop]) && $_POST[$prop] != $this->data->get($prop)) {
                $update_log_info[] = $prop;
            }
        }
        if (!empty($_POST['project_id']) && $_POST['project_id'] != $this->data->get('project')->get_uid()) {
            $update_log_info[] = 'project';
        }
        if (!empty($_POST['deadline_date']) && $_POST['deadline_date'] != $this->data->html('deadline_date')) {
            $update_log_info[] = 'deadline';
        }
    }
    $this->data->set_auto($_POST);
    if (!$this->data->get('project')->get_uid() || !$this->data->get('project')->load()) {