当前位置: 首页>>代码示例>>PHP>>正文


PHP CTask::getError方法代码示例

本文整理汇总了PHP中CTask::getError方法的典型用法代码示例。如果您正苦于以下问题:PHP CTask::getError方法的具体用法?PHP CTask::getError怎么用?PHP CTask::getError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTask的用法示例。


在下文中一共展示了CTask::getError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: explode

if (isset($htasks)) {
    $tarr = explode(',', $htasks);
    foreach ($tarr as $tid) {
        if (intval($tid) > 0) {
            $htasks_ar[] = $tid;
        }
    }
}
$sizeof = sizeof($htasks_ar);
for ($i = 0; $i <= $sizeof; $i++) {
    $_POST['task_id'] = $htasks_ar[$i];
    // verify that task_id is not NULL
    if ($_POST['task_id'] > 0) {
        $obj = new CTask();
        if (!$obj->bind($_POST)) {
            $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
            $AppUI->redirect();
        }
        if ($rm && $del) {
            $overAssignment = $obj->updateAssigned($hassign, $hperc_assign_ar, true, true);
            if ($overAssignment) {
                $AppUI->setMsg('Some Users could not be unassigned from Task', UI_MSG_ERROR);
            } else {
                // Don't do anything because we might have other tasks to change
                // $AppUI->setMsg('User(s) unassigned from Task', UI_MSG_OK);
                // $AppUI->redirect();
            }
        } else {
            if ($rm || $del) {
                if ($msg = $obj->removeAssigned($user_id)) {
                    $AppUI->setMsg($msg, UI_MSG_ERROR);
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:do_task_assign_aed.php

示例2: executePost

 /**
  * Post Request Handler
  *
  * This method is called when a request is a POST
  *
  * @return array
  */
 public function executePost()
 {
     /**
      * @todo Remove this once we figure out how to reference vars in file
      * that is autoloaded
      */
     global $tracking_dynamics;
     $valid = $this->hasRequiredParameters($this->requiredParams);
     if ($valid instanceof Frapi_Error) {
         return $valid;
     }
     $username = $this->getParam('username');
     $password = $this->getParam('password');
     $project_id = $this->getParam('project_id', self::TYPE_INT);
     $hassign = $this->getParam('hassign');
     $hdependencies = $this->getParam('hdependencies');
     $notify = $this->getParam('task_notify');
     $comment = $this->getParam('email_comment');
     $task_id = $this->getParam('task_id');
     $adjustStartDate = $this->getParam('set_task_start_date');
     $task = new CTask();
     // Attempt to login as user, a little bit of a hack as we currently
     // require the $_POST['login'] var to be set as well as a global AppUI
     $AppUI = new CAppUI();
     $GLOBALS['AppUI'] = $AppUI;
     $_POST['login'] = 'login';
     if (!$AppUI->login($username, $password)) {
         throw new Frapi_Error('INVALID_LOGIN');
     }
     $post_data = array('task_id' => $this->getParam('task_id'), 'task_name' => $this->getParam('task_name'), 'task_status' => $this->getParam('task_status'), 'task_percent_complete' => $this->getParam('task_percent_complete'), 'task_milestone' => $this->getParam('task_milestone'), 'task_owner' => $this->getParam('task_owner'), 'task_access' => $this->getParam('task_access'), 'task_related_url' => $this->getParam('task_related_url'), 'task_parent' => $this->getParam('task_parent'), 'task_type' => $this->getParam('task_type'), 'task_target_budget' => $this->getParam('task_target_budget'), 'task_description' => $this->getParam('task_description'), 'task_start_date' => $this->getParam('task_start_date'), 'task_end_date' => $this->getParam('task_end_date'), 'task_duration' => $this->getParam('task_duration'), 'task_duration_type' => $this->getParam('task_duration_type'), 'task_dynamic' => $this->getParam('task_dynamic'), 'task_allow_other_user_tasklogs' => $this->getParam('task_allow_other_user_tasklogs'), 'task_project' => $this->getParam('task_project'), 'task_priority' => $this->getParam('task_priority'));
     // Include any files for handling module-specific requirements
     foreach (findTabModules('tasks', 'addedit') as $mod) {
         $fname = W2P_BASE_DIR . '/modules/' . $mod . '/tasks_dosql.addedit.php';
         if (file_exists($fname)) {
             require_once $fname;
         }
     }
     // Find the task if we are set
     $task_end_date = null;
     if ($task_id) {
         $task->load($task_id);
         $task_end_date = new w2p_Utilities_Date($task->task_end_date);
     }
     $task = new CTask();
     if (!$task->bind($post_data)) {
         throw new Frapi_Error('SAVE_ERROR', $task->getError());
     }
     if ($task->task_dynamic != 1) {
         $task_dynamic_delay = $this->getParam('task_dynamic_nodelay') ? $this->getParam('task_dynamic_nodelay') : '0';
         if (in_array($task->task_dynamic, $tracking_dynamics)) {
             $task->task_dynamic = $task_dynamic_delay ? 21 : 31;
         } else {
             $task->task_dynamic = $task_dynamic_delay ? 11 : 0;
         }
     }
     // Let's check if task_dynamic is unchecked
     if (!$this->getParam('task_dynamic')) {
         $task->task_dynamic = false;
     }
     // Make sure task milestone is set or reset as appropriate
     if ($this->getParam('task_milestone')) {
         $task->task_milestone = false;
     }
     //format hperc_assign user_id=percentage_assignment;user_id=percentage_assignment;user_id=percentage_assignment;
     $tmp_ar = explode(';', $this->getParam('hperc_assign'));
     $i_cmp = sizeof($tmp_ar);
     $hperc_assign_ar = array();
     for ($i = 0; $i < $i_cmp; $i++) {
         $tmp = explode('=', $tmp_ar[$i]);
         if (count($tmp) > 1) {
             $hperc_assign_ar[$tmp[0]] = $tmp[1];
         } elseif ($tmp[0] != '') {
             $hperc_assign_ar[$tmp[0]] = 100;
         }
     }
     // let's check if there are some assigned departments to task
     $task->task_departments = implode(',', $this->getParam('dept_ids', self::TYPE_ARRAY));
     // convert dates to SQL format first
     if ($task->task_start_date) {
         $date = new w2p_Utilities_Date($task->task_start_date);
         $task->task_start_date = $date->format(FMT_DATETIME_MYSQL);
     }
     $end_date = null;
     if ($task->task_end_date) {
         if (strpos($task->task_end_date, '2400') !== false) {
             $task->task_end_date = str_replace('2400', '2359', $task->task_end_date);
         }
         $end_date = new w2p_Utilities_Date($task->task_end_date);
         $task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL);
     }
     $error_array = $task->store($AppUI);
     // Return all the validation messages
     if ($error_array !== true) {
//.........这里部分代码省略.........
开发者ID:robertbasic,项目名称:web2project-api,代码行数:101,代码来源:Task.php

示例3: updateTaskSummary

 /**
  * Updates the variable information on the task.
  *
  * @param int $task_log_task that task id of task this task log is for
  *
  * @return void
  *
  * @access private
  */
 protected function updateTaskSummary($AppUI = null, $task_id)
 {
     $q = $this->_getQuery();
     if ($this->_perms->checkModuleItem('tasks', 'edit', $task_id)) {
         if ($this->task_log_percent_complete < 100) {
             $q->addQuery('task_log_percent_complete, task_log_date');
             $q->addTable('task_log');
             $q->addWhere('task_log_task = ' . (int) $task_id);
             $q->addOrder('task_log_date DESC, task_log_id DESC');
             $q->setLimit(1);
             $results = $q->loadHash();
             $percentComplete = $results['task_log_percent_complete'];
         } else {
             $percentComplete = 100;
         }
         $task = new CTask();
         $task->overrideDatabase($this->_query);
         $task->load($task_id);
         $task->task_percent_complete = $percentComplete;
         $diff = strtotime($this->task_log_task_end_date) - strtotime($task->task_end_date);
         $task->task_end_date = 0 == $diff ? $task->task_end_date : $this->task_log_task_end_date;
         $success = $task->store();
         if (!$success) {
             $this->_AppUI->setMsg($task->getError(), UI_MSG_ERROR, true);
         }
         $task->pushDependencies($task_id, $task->task_end_date);
     }
     $q->addQuery('SUM(task_log_hours)');
     $q->addTable('task_log');
     $q->addWhere('task_log_task = ' . (int) $task_id);
     $totalHours = $q->loadResult();
     CTask::updateHoursWorked($task_id, $totalHours);
 }
开发者ID:,项目名称:,代码行数:42,代码来源:

示例4: elseif

                    }
                    // Option 9 - Mark as inactive
                } elseif ($bulk_task_other == '9') {
                    $upd_task->task_status = '-1';
                    $result = $upd_task->store();
                    if (!$result) {
                        break;
                    }
                    //Option 10 - Empty tasks description
                } elseif ($bulk_task_other == '10') {
                    $upd_task->task_description = '';
                    $result = $upd_task->store();
                    if (!$result) {
                        break;
                    }
                    //Option 99 (always at the bottom) - Delete
                } elseif ($bulk_task_other == '99') {
                    $result = $upd_task->delete();
                    if (!$result) {
                        break;
                    }
                }
            }
        }
        $AppUI->setMsg($upd_task->getError(), UI_MSG_ERROR);
    }
}
if (!$result) {
    $AppUI->setMsg($result, UI_MSG_ERROR);
}
$AppUI->redirect('m=projectdesigner&project_id=' . $project_id);
开发者ID:illuminate3,项目名称:web2project,代码行数:31,代码来源:do_task_bulk_aed.php

示例5: updateTaskSummary

 /**
  * Updates the variable information on the task.
  *
  * @param int $notUsed not used
  * @param int $task_id that task id of task this task log is for
  *
  * @return void
  *
  * @access protected
  */
 protected function updateTaskSummary($notUsed = null, $task_id)
 {
     $task = new CTask();
     $task->overrideDatabase($this->_query);
     $task->load($task_id);
     $q = $this->_getQuery();
     if ($this->_perms->checkModuleItem('tasks', 'edit', $task_id)) {
         if ($this->task_log_percent_complete <= 100) {
             $q->addQuery('task_log_percent_complete, task_log_date');
             $q->addTable('task_log');
             $q->addWhere('task_log_task = ' . (int) $task_id);
             $q->addOrder('task_log_date DESC, task_log_id DESC');
             $q->setLimit(1);
             $results = $q->loadHash();
             $percentComplete = $results['task_log_percent_complete'];
         } else {
             $percentComplete = 100;
         }
         $old_end_date = new w2p_Utilities_Date($task->task_end_date);
         $new_end_date = new w2p_Utilities_Date($this->task_log_task_end_date);
         $new_end_date->setHour($old_end_date->getHour());
         $new_end_date->setMinute($old_end_date->getMinute());
         $task_end_date = $new_end_date->format(FMT_DATETIME_MYSQL);
         /*
          * We're using a database update here instead of store() because a
          *   bunch of other things happen when you call store().. like the
          *   processing of contacts, departments, etc.
          */
         $q = $this->_getQuery();
         $q->addTable('tasks');
         $q->addUpdate('task_percent_complete', $percentComplete);
         $q->addUpdate('task_end_date', $task_end_date);
         $q->addWhere('task_id = ' . (int) $task_id);
         $success = $q->exec();
         if (!$success) {
             $this->_AppUI->setMsg($task->getError(), UI_MSG_ERROR, true);
         }
         $task->pushDependencies($task_id, $task_end_date);
     }
     $q->addQuery('SUM(task_log_hours)');
     $q->addTable('task_log');
     $q->addWhere('task_log_task = ' . (int) $task_id);
     $totalHours = $q->loadResult();
     $task->updateHoursWorked2($task_id, $totalHours);
     $task->updateDynamics();
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:56,代码来源:logs.class.php

示例6: elseif

            $date = new w2p_Utilities_Date($elements['add_task_end_date_' . $on]);
            $end_date = $date->format(FMT_DATETIME_MYSQL);
            $end_date = $AppUI->convertToSystemTZ($end_date);
        }
        $tline->task_end_date = $end_date;
        $tline->task_duration = $elements['add_task_duration_' . $on];
        $tline->task_duration_type = $elements['add_task_durntype_' . $on];
        $tline->task_priority = $elements['add_task_priority_' . $on];
        $tline->task_type = $elements['add_task_type_' . $on];
        $tline->task_access = $elements['add_task_access_' . $on];
        $tline->task_description = $elements['add_task_description_' . $on] ? $elements['add_task_description_' . $on] : '';
        $tline->task_owner = $AppUI->user_id;
        $tline->task_dynamic = 31;
        if ($elements['add_task_extra_' . $on] == '1') {
            $tline->task_milestone = '1';
        } elseif ($elements['add_task_extra_' . $on] == '2') {
            $tline->task_dynamic = '1';
        } elseif ($elements['add_task_extra_' . $on] == '3') {
            $tline->task_status = '-1';
        }
        $result = $tline->store();
        $tline->updateAssigned($AppUI->user_id, array($AppUI->user_id => 100));
        if (count($tline->getError())) {
            $taskErrors[] = $tline->getError();
        }
    }
}
if (count($taskErrors) > 0) {
    $AppUI->setMsg($result, UI_MSG_ERROR);
}
$AppUI->redirect('m=projectdesigner&project_id=' . $project_id);
开发者ID:illuminate3,项目名称:web2project,代码行数:31,代码来源:do_addtasks_aed.php


注:本文中的CTask::getError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。