Esempio n. 1
0
 /**
  * Get data to export 
  * 
  * @param  string $productID 
  * @param  string $orderBy 
  * @access public
  * @return void
  */
 public function export($account, $orderBy)
 {
     if ($_POST) {
         $todoLang = $this->lang->todo;
         $todoConfig = $this->config->todo;
         /* Create field lists. */
         $fields = explode(',', $todoConfig->list->exportFields);
         foreach ($fields as $key => $fieldName) {
             $fieldName = trim($fieldName);
             $fields[$fieldName] = isset($todoLang->{$fieldName}) ? $todoLang->{$fieldName} : $fieldName;
             unset($fields[$key]);
         }
         unset($fields['idvalue']);
         unset($fields['private']);
         /* Get bugs. */
         $todos = $this->dao->select('*')->from(TABLE_TODO)->where($this->session->todoReportCondition)->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()->orderBy($orderBy)->fetchAll('id');
         /* Get users, bugs, tasks and times. */
         $users = $this->loadModel('user')->getPairs('noletter');
         $bugs = $this->loadModel('bug')->getUserBugPairs($account);
         $tasks = $this->loadModel('task')->getUserTaskPairs($account);
         $times = date::buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta);
         foreach ($todos as $todo) {
             /* fill some field with useful value. */
             if (isset($users[$todo->account])) {
                 $todo->account = $users[$todo->account];
             }
             if (isset($times[$todo->begin])) {
                 $todo->begin = $times[$todo->begin];
             }
             if (isset($times[$todo->end])) {
                 $todo->end = $times[$todo->end];
             }
             if ($todo->type == 'bug') {
                 $todo->name = isset($bugs[$todo->idvalue]) ? $bugs[$todo->idvalue] . "(#{$todo->idvalue})" : '';
             }
             if ($todo->type == 'task') {
                 $todo->name = isset($tasks[$todo->idvalue]) ? $tasks[$todo->idvalue] . "(#{$todo->idvalue})" : '';
             }
             if (isset($todoLang->typeList[$todo->type])) {
                 $todo->type = $todoLang->typeList[$todo->type];
             }
             if (isset($todoLang->priList[$todo->pri])) {
                 $todo->pri = $todoLang->priList[$todo->pri];
             }
             if (isset($todoLang->statusList[$todo->status])) {
                 $todo->status = $todoLang->statusList[$todo->status];
             }
             if ($todo->private == 1) {
                 $todo->desc = $this->lang->todo->thisIsPrivate;
             }
             /* drop some field that is not needed. */
             unset($todo->idvalue);
             unset($todo->private);
         }
         $this->post->set('fields', $fields);
         $this->post->set('rows', $todos);
         $this->post->set('kind', 'todo');
         $this->fetch('file', 'export2' . $this->post->fileType, $_POST);
     }
     $this->display();
 }
Esempio n. 2
0
 /**
  * Assign one todo to someone. 
  * 
  * @param  int    $todoID 
  * @access public
  * @return void
  */
 public function assignTo($todoID)
 {
     $todo = $this->todo->getById($todoID);
     $this->checkPriv($todo, 'assignTo');
     if ($_POST) {
         $changes = $this->todo->assignTo($todoID);
         if (!empty($changes)) {
             $actionID = $this->loadModel('action')->create('todo', $todo->id, 'Assigned', '', $this->post->assignedTo);
             $this->action->logHistory($actionID, $changes);
             $this->sendmail($todoID, $actionID);
         }
         if (dao::isError()) {
             $this->send(array('result' => 'fail', 'message' => dao::getError()));
         }
         $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => 'true', 'locate' => 'reload'));
     }
     if ($todo->date != '00000000') {
         $todo->date = strftime("%Y-%m-%d", strtotime($todo->date));
     }
     $this->view->title = $this->lang->todo->assignTo;
     $this->view->todo = $todo;
     $this->view->users = $this->loadModel('user')->getPairs('nodeleted,noclosed');
     $this->view->times = date::buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta);
     $this->display();
 }