コード例 #1
0
ファイル: control.php プロジェクト: leowh/colla
 /**
  * Turnon cron. 
  * 
  * @access public
  * @return void
  */
 public function turnon($confirm = 'no')
 {
     $turnon = empty($this->config->global->cron) ? 1 : 0;
     if (!$turnon and $confirm == 'no') {
         die(js::confirm($this->lang->cron->confirmTurnon, inlink('turnon', "confirm=yes")) . js::reload('parent'));
     }
     $this->loadModel('setting')->setItem('system.sys.common.global.cron', $turnon);
     die(js::reload('parent'));
 }
コード例 #2
0
ファイル: control.php プロジェクト: heeeello/zentaopms
 public function manage($productID)
 {
     if ($_POST) {
         $this->branch->manage($productID);
         die(js::reload('parent'));
     }
     $this->view->title = $this->lang->branch->manage;
     $this->view->position[] = $this->lang->branch->manage;
     $this->loadModel('product')->setMenu($this->product->getPairs('nocode'), $productID);
     $this->view->product = $this->product->getById($productID);
     $this->view->branches = $this->branch->getPairs($productID, 'noempty');
     $this->display();
 }
コード例 #3
0
ファイル: model.php プロジェクト: XMGmen/zentao
 /**
  * Create batch todo
  * 
  * @access public
  * @return void
  */
 public function batchCreate()
 {
     $todos = fixer::input('post')->cleanInt('date')->get();
     for ($i = 0; $i < $this->config->todo->batchCreate; $i++) {
         if ($todos->names[$i] != '' || isset($todos->bugs[$i + 1]) || isset($todos->tasks[$i + 1])) {
             $todo = new stdclass();
             $todo->account = $this->app->user->account;
             if ($this->post->date == false) {
                 $todo->date = '2030-01-01';
             } else {
                 $todo->date = $this->post->date;
             }
             $todo->type = $todos->types[$i];
             $todo->pri = $todos->pris[$i];
             $todo->name = isset($todos->names[$i]) ? $todos->names[$i] : '';
             $todo->desc = $todos->descs[$i];
             $todo->begin = isset($todos->begins[$i]) ? $todos->begins[$i] : 2400;
             $todo->end = isset($todos->ends[$i]) ? $todos->ends[$i] : 2400;
             $todo->status = "wait";
             $todo->private = 0;
             $todo->idvalue = 0;
             if ($todo->type == 'bug') {
                 $todo->idvalue = isset($todos->bugs[$i + 1]) ? $todos->bugs[$i + 1] : 0;
             }
             if ($todo->type == 'task') {
                 $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0;
             }
             $this->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->exec();
             if (dao::isError()) {
                 echo js::error(dao::getError());
                 die(js::reload('parent'));
             }
             $this->loadModel('action')->create('todo', $this->dao->lastInsertID(), 'opened');
         } else {
             unset($todos->types[$i]);
             unset($todos->pris[$i]);
             unset($todos->names[$i]);
             unset($todos->descs[$i]);
             unset($todos->begins[$i]);
             unset($todos->ends[$i]);
         }
     }
 }
コード例 #4
0
 /**
  * Create batch todo
  * 
  * @access public
  * @return void
  */
 public function batchCreate()
 {
     $todos = fixer::input('post')->cleanInt('date')->get();
     for ($i = 0; $i < $this->config->todo->batchCreate; $i++) {
         if ($todos->names[$i] != '' || isset($todos->bugs[$i + 1]) || isset($todos->tasks[$i + 1])) {
             $todo->account = $this->app->user->account;
             $todo->date = $this->post->date;
             $todo->type = $todos->types[$i];
             $todo->pri = $todos->pris[$i];
             $todo->name = isset($todos->names[$i]) ? $todos->names[$i] : '';
             $todo->desc = $todos->descs[$i];
             $todo->begin = $todos->begins[$i];
             $todo->end = $todos->ends[$i];
             $todo->source = isset($todos->source) ? $todos->source : 'todo';
             $todo->status = "wait";
             $todo->private = 0;
             $todo->idvalue = 0;
             if ($todo->type == 'bug') {
                 $todo->idvalue = isset($todos->bugs[$i + 1]) ? $todos->bugs[$i + 1] : 0;
             }
             if ($todo->type == 'task') {
                 $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0;
             }
             $this->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->exec();
             if (dao::isError()) {
                 echo js::error(dao::getError());
                 die(js::reload('parent'));
             }
         } else {
             unset($todos->types[$i]);
             unset($todos->pris[$i]);
             unset($todos->names[$i]);
             unset($todos->descs[$i]);
             unset($todos->begins[$i]);
             unset($todos->ends[$i]);
         }
     }
 }
コード例 #5
0
ファイル: model.php プロジェクト: TigerLau1985/ZenTao_LDAP
 public function sync2db($config)
 {
     $ldapUsers = $this->getUsers($config);
     $user = new stdclass();
     $account = '';
     $i = 0;
     for (; $i < $ldapUsers['count']; $i++) {
         $user->account = $ldapUsers[$i][$config->uid][0];
         $user->email = $ldapUsers[$i][$config->mail][0];
         $user->realname = $ldapUsers[$i][$config->name][0];
         $account = $this->dao->select('*')->from(TABLE_USER)->where('account')->eq($user->account)->fetch('account');
         if ($account == $user->account) {
             $this->dao->update(TABLE_USER)->data($user)->where('account')->eq($user->account)->autoCheck()->exec();
         } else {
             $this->dao->insert(TABLE_USER)->data($user)->autoCheck()->exec();
         }
         if (dao::isError()) {
             echo js::error(dao::getError());
             die(js::reload('parent'));
         }
     }
     return $i;
 }
コード例 #6
0
ファイル: model.php プロジェクト: xupnge1314/project
 public function updateDefaultPwd()
 {
     $data = fixer::input('post')->get();
     $pwdList = $this->post->pwdList ? $this->post->pwdList : array();
     if (!empty($pwdList)) {
         /* Initialize todos from the post data. */
         foreach ($pwdList as $pwdID) {
             $pwd = $data->password[$pwdID];
             if ('' === $pwd) {
                 continue;
             }
             if ($pwdID > 0) {
                 $this->updatePwd($pwdID, $pwd);
             } else {
                 $this->setdefaultpwd($pwd);
             }
         }
     }
     if (dao::isError()) {
         echo js::error(dao::getError());
         die(js::reload('parent'));
     }
 }
コード例 #7
0
 /**
  * order product 
  * 
  * @param  int    $productID 
  * @access public
  * @return void
  */
 public function order($productID)
 {
     if ($_POST) {
         $this->product->saveOrder();
         die(js::reload('parent'));
     }
     $this->product->setMenu($this->products, $productID);
     $this->view->products = $this->product->getList('noclosed');
     $this->display();
 }
コード例 #8
0
ファイル: control.php プロジェクト: huokedu/zentao
 /**
  * Batch close tasks.
  * 
  * @access public
  * @return void
  */
 public function batchClose()
 {
     if ($this->post->tasks) {
         $tasks = $this->post->tasks;
         unset($_POST['tasks']);
         $this->loadModel('action');
         foreach ($tasks as $taskID) {
             $this->commonAction($taskID);
             $task = $this->task->getById($taskID);
             if ($task->status == 'wait' or $task->status == 'doing') {
                 continue;
             }
             $changes = $this->task->close($taskID);
             if ($changes) {
                 $actionID = $this->action->create('task', $taskID, 'Closed', '');
                 $this->action->logHistory($actionID, $changes);
                 $this->sendmail($taskID, $actionID);
             }
         }
     }
     die(js::reload('parent'));
 }
コード例 #9
0
ファイル: control.php プロジェクト: XMGmen/zentao
 /**
  * Confirm story changes.
  * 
  * @param  int   $caseID 
  * @access public
  * @return void
  */
 public function confirmStoryChange($caseID)
 {
     $case = $this->testcase->getById($caseID);
     $this->dao->update(TABLE_CASE)->set('storyVersion')->eq($case->latestStoryVersion)->where('id')->eq($caseID)->exec();
     $this->loadModel('action')->create('case', $caseID, 'confirmed', '', $case->latestStoryVersion);
     die(js::reload('parent'));
 }
コード例 #10
0
ファイル: control.php プロジェクト: laiello/zentaoms
 /**
  * Set flow.
  * 
  * @access public
  * @return void
  */
 public function setFlow()
 {
     if ($_POST) {
         $this->loadModel('setting')->setItem('system.common.global.flow', $this->post->flow, 0);
         if ($this->post->flow != 'full') {
             die(js::locate($this->createLink('extension', 'install', "extension={$this->config->admin->flow2Ext[$this->post->flow]}"), 'parent'));
         }
         die(js::reload('parent.parent'));
     }
     $this->display();
 }
コード例 #11
0
ファイル: control.php プロジェクト: jsyinwenjun/zentao
 /**
  * Confirm story change.
  * 
  * @param  int    $bugID 
  * @access public
  * @return void
  */
 public function confirmStoryChange($bugID)
 {
     $bug = $this->bug->getById($bugID);
     $this->dao->update(TABLE_BUG)->set('storyVersion')->eq($bug->latestStoryVersion)->where('id')->eq($bugID)->exec();
     $this->loadModel('action')->create('bug', $bugID, 'confirmed', '', $bug->latestStoryVersion);
     die(js::reload('parent'));
 }
コード例 #12
0
 /**
  * Mark status of a todo.
  * 
  * @param  int    $todoID 
  * @param  string $status   wait|doing|done
  * @access public
  * @return void
  */
 public function mark($todoID, $status)
 {
     $this->todo->mark($todoID, $status);
     $todo = $this->todo->getById($todoID);
     if ($todo->status == 'done') {
         if ($todo->type == 'bug' or $todo->type == 'task') {
             $confirmNote = 'confirm' . ucfirst($todo->type);
             $confirmURL = $this->createLink($todo->type, 'view', "id={$todo->idvalue}");
             $cancelURL = $this->server->HTTP_REFERER;
             die(js::confirm(sprintf($this->lang->todo->{$confirmNote}, $todo->idvalue), $confirmURL, $cancelURL, 'parent', 'parent'));
         }
     }
     die(js::reload('parent'));
 }
コード例 #13
0
ファイル: control.php プロジェクト: XMGmen/zentao
 /**
  * Batch finish todos.
  * 
  * @access public
  * @return void
  */
 public function batchFinish()
 {
     if (!empty($_POST['todoIDList'])) {
         foreach ($_POST['todoIDList'] as $todoID) {
             $todo = $this->todo->getById($todoID);
             if ($todo->status != 'done') {
                 $this->todo->finish($todoID);
             }
         }
         die(js::reload('parent'));
     }
 }
コード例 #14
0
ファイル: control.php プロジェクト: XMGmen/zentao
 /**
  * Flow zentao. 
  * 
  * @access public
  * @return void
  */
 public function flow()
 {
     if ($_POST) {
         $this->loadModel('setting')->setItem('system.custom.productproject', $this->post->productproject);
         die(js::reload('parent'));
     }
     $this->view->title = $this->lang->custom->flow;
     $this->view->position[] = $this->lang->custom->flow;
     $this->display();
 }
コード例 #15
0
ファイル: control.php プロジェクト: nanata1115/zentaopms
 /**
  * Close product.
  * 
  * @param  int    $productID 
  * @access public
  * @return void
  */
 public function close($productID)
 {
     $product = $this->product->getById($productID);
     $actions = $this->loadModel('action')->getList('product', $productID);
     if (!empty($_POST)) {
         $changes = $this->product->close($productID);
         if (dao::isError()) {
             die(js::error(dao::getError()));
         }
         if ($this->post->comment != '' or !empty($changes)) {
             $actionID = $this->action->create('product', $productID, 'Closed', $this->post->comment);
             $this->action->logHistory($actionID, $changes);
         }
         die(js::reload('parent.parent'));
     }
     $this->product->setMenu($this->products, $productID);
     $this->view->product = $product;
     $this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->close;
     $this->view->position[] = $this->lang->close;
     $this->view->actions = $actions;
     $this->view->users = $this->loadModel('user')->getPairs('noletter');
     $this->display();
 }
コード例 #16
0
 /**
  * Order project 
  * 
  * @param  int    $projectID 
  * @access public
  * @return void
  */
 public function order($projectID)
 {
     if ($_POST) {
         $this->project->saveOrder();
         die(js::reload('parent'));
     }
     $project = $this->commonAction($projectID);
     $this->project->setMenu($this->projects, $project->id);
     $this->view->projects = $this->project->getList();
     $this->view->projectID = $project->id;
     $this->display();
 }
コード例 #17
0
ファイル: control.php プロジェクト: iamazhi/zentaopms
 /**
  * Edit a company.
  * 
  * @access public
  * @return void
  */
 public function edit()
 {
     if (!empty($_POST)) {
         $this->company->update();
         if (dao::isError()) {
             die(js::error(dao::getError()));
         }
         /* reset company in session. */
         $company = $this->loadModel('company')->getFirst();
         $this->session->set('company', $company);
         die(js::reload('parent.parent'));
     }
     $title = $this->lang->company->common . $this->lang->colon . $this->lang->company->edit;
     $position[] = $this->lang->company->edit;
     $this->view->title = $title;
     $this->view->position = $position;
     $this->view->company = $this->company->getById($this->app->company->id);
     $this->display();
 }
コード例 #18
0
ファイル: control.php プロジェクト: fanscky/HTPMS
 /**
  * Delete 
  * 
  * @param  string $fileName 
  * @param  string $confirm 
  * @access public
  * @return void
  */
 public function delete($fileName, $confirm = 'no')
 {
     if ($confirm == 'no') {
         die(js::confirm($this->lang->backup->confirmDelete, inlink('delete', "fileName={$fileName}&confirm=yes")));
     }
     /* Delete database file. */
     if (file_exists($this->backupPath . $fileName . '.sql.php') and !unlink($this->backupPath . $fileName . '.sql.php')) {
         die(js::alert(sprintf($this->lang->backup->error->noDelete, $this->backupPath . $fileName . '.sql.php')));
     }
     /* Delete attatchments file. */
     if (file_exists($this->backupPath . $fileName . '.file.zip.php') and !unlink($this->backupPath . $fileName . '.file.zip.php')) {
         die(js::alert(sprintf($this->lang->backup->error->noDelete, $this->backupPath . $fileName . '.file.zip.php')));
     }
     die(js::reload('parent'));
 }
コード例 #19
0
 /**
  * Create a batch case.
  * 
  * @access public
  * @return void
  */
 function batchCreate($productID)
 {
     $now = helper::now();
     $cases = fixer::input('post')->get();
     for ($i = 0; $i < $this->config->testcase->batchCreate; $i++) {
         if ($cases->type[$i] != '' and $cases->title[$i] != '') {
             $data[$i]->product = $productID;
             $data[$i]->module = $cases->module[$i] == 'same' ? $i == 0 ? 0 : $data[$i - 1]->module : $cases->module[$i];
             $data[$i]->type = $cases->type[$i] == 'same' ? $i == 0 ? '' : $data[$i - 1]->type : $cases->type[$i];
             $data[$i]->story = $cases->story[$i] == 'same' ? $i == 0 ? 0 : $data[$i - 1]->story : $cases->story[$i];
             $data[$i]->title = $cases->title[$i];
             $data[$i]->openedBy = $this->app->user->account;
             $data[$i]->openedDate = $now;
             $data[$i]->status = 'normal';
             $data[$i]->version = 1;
             if ($data[$i]->story != 0) {
                 $data[$i]->storyVersion = $this->loadModel('story')->getVersion($this->post->story);
             }
             $this->dao->insert(TABLE_CASE)->data($data[$i])->autoCheck()->batchCheck($this->config->testcase->create->requiredFields, 'notempty')->exec();
             if (dao::isError()) {
                 echo js::error(dao::getError());
                 die(js::reload('parent'));
             }
             $caseID = $this->dao->lastInsertID();
             $actionID = $this->loadModel('action')->create('case', $caseID, 'Opened');
         } else {
             unset($cases->module[$i]);
             unset($cases->type[$i]);
             unset($cases->story[$i]);
             unset($cases->title[$i]);
         }
     }
 }
コード例 #20
0
ファイル: control.php プロジェクト: fanscky/HTPMS
 /**
  * Close testtask.
  * 
  * @param  int    $taskID 
  * @access public
  * @return void
  */
 public function close($taskID)
 {
     $actions = $this->loadModel('action')->getList('testtask', $taskID);
     if (!empty($_POST)) {
         $changes = $this->testtask->close($taskID);
         if (dao::isError()) {
             die(js::error(dao::getError()));
         }
         if ($this->post->comment != '' or !empty($changes)) {
             $actionID = $this->action->create('testtask', $taskID, 'Closed', $this->post->comment);
             $this->action->logHistory($actionID, $changes);
         }
         if (isonlybody()) {
             die(js::reload('parent.parent'));
         }
         die(js::locate($this->createLink('testtask', 'view', "taskID={$taskID}"), 'parent'));
     }
     /* Get task info. */
     $testtask = $this->testtask->getById($taskID);
     $productID = $this->product->saveState($testtask->product, $this->products);
     /* Set menu. */
     $this->testtask->setMenu($this->products, $productID);
     $this->view->testtask = $this->testtask->getById($taskID);
     $this->view->title = $testtask->name . $this->lang->colon . $this->lang->close;
     $this->view->position[] = $this->lang->testtask->common;
     $this->view->position[] = $this->lang->close;
     $this->view->actions = $actions;
     $this->display();
 }
コード例 #21
0
ファイル: model.php プロジェクト: XMGmen/zentao
 /**
  * Batch create users. 
  * 
  * @param  int    $users 
  * @access public
  * @return void
  */
 public function batchCreate()
 {
     if (empty($_POST['verifyPassword']) or md5($this->post->verifyPassword) != $this->app->user->password) {
         die(js::alert($this->lang->user->error->verifyPassword));
     }
     $users = fixer::input('post')->get();
     $data = array();
     $accounts = array();
     for ($i = 0; $i < $this->config->user->batchCreate; $i++) {
         if ($users->account[$i] != '') {
             $account = $this->dao->select('account')->from(TABLE_USER)->where('account')->eq($users->account[$i])->fetch();
             if ($account) {
                 die(js::error(sprintf($this->lang->user->error->accountDupl, $i + 1)));
             }
             if (in_array($users->account[$i], $accounts)) {
                 die(js::error(sprintf($this->lang->user->error->accountDupl, $i + 1)));
             }
             if (!validater::checkAccount($users->account[$i])) {
                 die(js::error(sprintf($this->lang->user->error->account, $i + 1)));
             }
             if ($users->realname[$i] == '') {
                 die(js::error(sprintf($this->lang->user->error->realname, $i + 1)));
             }
             if ($users->email[$i] and !validater::checkEmail($users->email[$i])) {
                 die(js::error(sprintf($this->lang->user->error->mail, $i + 1)));
             }
             $users->password[$i] = (isset($prev['password']) and $users->ditto[$i] == 'on' and empty($users->password[$i])) ? $prev['password'] : $users->password[$i];
             if (!validater::checkReg($users->password[$i], '|(.){6,}|')) {
                 die(js::error(sprintf($this->lang->user->error->password, $i + 1)));
             }
             $role = $users->role[$i] == 'ditto' ? isset($prev['role']) ? $prev['role'] : '' : $users->role[$i];
             $data[$i] = new stdclass();
             $data[$i]->dept = $users->dept[$i] == 'ditto' ? isset($prev['dept']) ? $prev['dept'] : 0 : $users->dept[$i];
             $data[$i]->account = $users->account[$i];
             $data[$i]->realname = $users->realname[$i];
             $data[$i]->role = $role;
             $data[$i]->group = $users->group[$i] == 'ditto' ? isset($prev['group']) ? $prev['group'] : '' : $users->group[$i];
             $data[$i]->email = $users->email[$i];
             $data[$i]->gender = $users->gender[$i];
             $data[$i]->password = md5($users->password[$i]);
             $accounts[$i] = $data[$i]->account;
             $prev['dept'] = $data[$i]->dept;
             $prev['role'] = $data[$i]->role;
             $prev['group'] = $data[$i]->group;
             $prev['password'] = $users->password[$i];
         }
     }
     foreach ($data as $user) {
         if ($user->group) {
             $group = new stdClass();
             $group->account = $user->account;
             $group->group = $user->group;
             $this->dao->insert(TABLE_USERGROUP)->data($group)->exec();
         }
         unset($user->group);
         $this->dao->insert(TABLE_USER)->data($user)->autoCheck()->exec();
         if (dao::isError()) {
             echo js::error(dao::getError());
             die(js::reload('parent'));
         }
     }
 }
コード例 #22
0
ファイル: model.php プロジェクト: XMGmen/zentao
 /**
  * Batch create cases.
  * 
  * @param  int    $productID 
  * @param  int    $storyID 
  * @access public
  * @return void
  */
 function batchCreate($productID, $storyID)
 {
     $now = helper::now();
     $cases = fixer::input('post')->get();
     $batchNum = count(reset($cases));
     $result = $this->loadModel('common')->removeDuplicate('case', $cases, "product={$productID}");
     $cases = $result['data'];
     for ($i = 0; $i < $batchNum; $i++) {
         if (!empty($cases->title[$i]) and empty($cases->type[$i])) {
             die(js::alert(sprintf($this->lang->error->notempty, $this->lang->testcase->type)));
         }
     }
     $module = 0;
     $story = 0;
     $type = '';
     for ($i = 0; $i < $batchNum; $i++) {
         $module = $cases->module[$i] == 'same' ? $module : $cases->module[$i];
         $story = $cases->story[$i] == 'same' ? $story : $cases->story[$i];
         $type = $cases->type[$i] == 'same' ? $type : $cases->type[$i];
         $cases->module[$i] = (int) $module;
         $cases->story[$i] = (int) $story;
         $cases->type[$i] = $type;
     }
     for ($i = 0; $i < $batchNum; $i++) {
         if ($cases->type[$i] != '' and $cases->title[$i] != '') {
             $data[$i] = new stdclass();
             $data[$i]->product = $productID;
             $data[$i]->module = $cases->module[$i];
             $data[$i]->type = $cases->type[$i];
             $data[$i]->story = $storyID ? $storyID : $cases->story[$i];
             $data[$i]->title = $cases->title[$i];
             $data[$i]->openedBy = $this->app->user->account;
             $data[$i]->openedDate = $now;
             $data[$i]->status = 'normal';
             $data[$i]->version = 1;
             if (!$data[$i]->story) {
                 $data[$i]->story = 0;
             } else {
                 $data[$i]->storyVersion = $this->loadModel('story')->getVersion($this->post->story);
             }
             $this->dao->insert(TABLE_CASE)->data($data[$i])->autoCheck()->batchCheck($this->config->testcase->create->requiredFields, 'notempty')->exec();
             if (dao::isError()) {
                 echo js::error(dao::getError());
                 die(js::reload('parent'));
             }
             $caseID = $this->dao->lastInsertID();
             $actionID = $this->loadModel('action')->create('case', $caseID, 'Opened');
         } else {
             unset($cases->module[$i]);
             unset($cases->type[$i]);
             unset($cases->story[$i]);
             unset($cases->title[$i]);
         }
     }
 }
コード例 #23
0
ファイル: model.php プロジェクト: laiello/zentaoms
 /**
  * Create a batch stories.
  * 
  * @access public
  * @return int|bool the id of the created story or false when error.
  */
 public function batchCreate($productID = 0)
 {
     $now = helper::now();
     $stories = fixer::input('post')->get();
     for ($i = 0; $i < $this->config->story->batchCreate; $i++) {
         if ($stories->title[$i] != '') {
             $data[$i] = new stdclass();
             $data[$i]->module = $stories->module[$i] != 'same' ? $stories->module[$i] : ($i == 0 ? 0 : $data[$i - 1]->module);
             $data[$i]->plan = $stories->plan[$i] == 'same' ? $i != 0 ? $data[$i - 1]->plan : 0 : ($stories->plan[$i] != '' ? $stories->plan[$i] : 0);
             $data[$i]->title = htmlspecialchars($stories->title[$i]);
             $data[$i]->pri = $stories->pri[$i] != '' ? $stories->pri[$i] : 0;
             $data[$i]->estimate = $stories->estimate[$i] != '' ? $stories->estimate[$i] : 0;
             $data[$i]->status = $stories->needReview[$i] == 0 ? 'active' : 'draft';
             $data[$i]->product = $productID;
             $data[$i]->openedBy = $this->app->user->account;
             $data[$i]->openedDate = $now;
             $data[$i]->version = 1;
             $this->dao->insert(TABLE_STORY)->data($data[$i])->autoCheck()->batchCheck($this->config->story->create->requiredFields, 'notempty')->exec();
             if (dao::isError()) {
                 echo js::error(dao::getError());
                 die(js::reload('parent'));
             }
             $storyID = $this->dao->lastInsertID();
             $this->setStage($storyID);
             $specData[$i]->story = $storyID;
             $specData[$i]->version = 1;
             $specData[$i]->title = htmlspecialchars($stories->title[$i]);
             if ($stories->spec[$i] != '') {
                 $specData[$i]->spec = htmlspecialchars($stories->spec[$i]);
             }
             $this->dao->insert(TABLE_STORYSPEC)->data($specData[$i])->exec();
             $this->loadModel('action');
             $actionID = $this->action->create('story', $storyID, 'Opened', '');
             $mails[$i]->storyID = $storyID;
             $mails[$i]->actionID = $actionID;
         } else {
             unset($stories->use[$i]);
             unset($stories->module[$i]);
             unset($stories->plan[$i]);
             unset($stories->title[$i]);
             unset($stories->spec[$i]);
             unset($stories->pri[$i]);
             unset($stories->estimate[$i]);
             unset($stories->needReview[$i]);
         }
     }
     return $mails;
 }
コード例 #24
0
ファイル: control.php プロジェクト: Wen1750686723/zentaopms
 /**
  * Account safe.
  * 
  * @access public
  * @return void
  */
 public function safe()
 {
     if ($_POST) {
         $data = fixer::input('post')->get();
         $this->loadModel('setting')->setItems('system.common.safe', $data);
         die(js::reload('parent'));
     }
     $this->view->title = $this->lang->admin->safe->common . $this->lang->colon . $this->lang->admin->safe->set;
     $this->view->position[] = $this->lang->admin->safe->common;
     $this->display();
 }
コード例 #25
0
ファイル: model.php プロジェクト: nanata1115/zentaopms
 /**
  * Import task from Bug. 
  * 
  * @param  int    $projectID 
  * @access public
  * @return void
  */
 public function importBug($projectID)
 {
     $this->loadModel('bug');
     $this->loadModel('task');
     $this->loadModel('story');
     $now = helper::now();
     $modules = $this->loadModel('tree')->getTaskOptionMenu($projectID);
     $bugToTasks = fixer::input('post')->get();
     $bugs = $this->bug->getByList(array_keys($bugToTasks->import));
     foreach ($bugToTasks->import as $key => $value) {
         $bug = $bugs[$key];
         $task = new stdClass();
         $task->project = $projectID;
         $task->story = $bug->story;
         $task->storyVersion = $bug->storyVersion;
         $task->module = isset($modules[$bug->module]) ? $bug->module : 0;
         $task->fromBug = $key;
         $task->name = $bug->title;
         $task->type = 'devel';
         $task->pri = $bugToTasks->pri[$key];
         $task->consumed = 0;
         $task->status = 'wait';
         $task->desc = $this->lang->bug->resolve . ':' . '#' . html::a(helper::createLink('bug', 'view', "bugID={$key}"), sprintf('%03d', $key));
         $task->openedDate = $now;
         $task->openedBy = $this->app->user->account;
         if (!empty($bugToTasks->estimate[$key])) {
             $task->estimate = $bugToTasks->estimate[$key];
             $task->left = $task->estimate;
         }
         if (!empty($bugToTasks->assignedTo[$key])) {
             $task->assignedTo = $bugToTasks->assignedTo[$key];
             $task->assignedDate = $now;
         }
         if (!$bug->confirmed) {
             $this->dao->update(TABLE_BUG)->set('confirmed')->eq(1)->where('id')->eq($bug->id)->exec();
         }
         $this->dao->insert(TABLE_TASK)->data($task)->checkIF($bugToTasks->estimate[$key] != '', 'estimate', 'float')->exec();
         if (dao::isError()) {
             echo js::error(dao::getError());
             die(js::reload('parent'));
         }
         $taskID = $this->dao->lastInsertID();
         if ($task->story != false) {
             $this->story->setStage($task->story);
         }
         $actionID = $this->loadModel('action')->create('task', $taskID, 'Opened', '');
         $mails[$key] = new stdClass();
         $mails[$key]->taskID = $taskID;
         $mails[$key]->actionID = $actionID;
         $this->action->create('bug', $key, 'Totask', '', $taskID);
         $this->dao->update(TABLE_BUG)->set('toTask')->eq($taskID)->where('id')->eq($key)->exec();
         /* activate bug if bug postponed. */
         if ($bug->status == 'resolved' && $bug->resolution == 'postponed') {
             $newBug = new stdclass();
             $newBug->lastEditedBy = $this->app->user->account;
             $newBug->lastEditedDate = $now;
             $newBug->assignedDate = $now;
             $newBug->status = 'active';
             $newBug->resolvedDate = '0000-00-00';
             $newBug->resolution = '';
             $newBug->resolvedBy = '';
             $newBug->resolvedBuild = '';
             $newBug->closedBy = '';
             $newBug->closedDate = '0000-00-00';
             $newBug->duplicateBug = '0';
             $this->dao->update(TABLE_BUG)->data($newBug)->autoCheck()->where('id')->eq($key)->exec();
             $this->dao->update(TABLE_BUG)->set('activatedCount = activatedCount + 1')->where('id')->eq($key)->exec();
             $actionID = $this->action->create('bug', $key, 'Activated');
             $changes = common::createChanges($bug, $newBug);
             $this->action->logHistory($actionID, $changes);
         }
         if (isset($task->assignedTo) and $task->assignedTo and $task->assignedTo != $bug->assignedTo) {
             $newBug = new stdClass();
             $newBug->lastEditedBy = $this->app->user->account;
             $newBug->lastEditedDate = $now;
             $newBug->assignedTo = $task->assignedTo;
             $newBug->assignedDate = $now;
             $this->dao->update(TABLE_BUG)->data($newBug)->where('id')->eq($key)->exec();
             if (dao::isError()) {
                 die(js::error(dao::getError()));
             }
             $changes = common::createChanges($bug, $newBug);
             $actionID = $this->action->create('bug', $key, 'Assigned', '', $newBug->assignedTo);
             $this->action->logHistory($actionID, $changes);
         }
     }
     return $mails;
 }
コード例 #26
0
ファイル: control.php プロジェクト: fanscky/HTPMS
 /**
  * Batch unlink story. 
  * 
  * @param  int $buildID 
  * @access public
  * @return void
  */
 public function batchUnlinkBug($buildID)
 {
     $this->build->batchUnlinkBug($buildID);
     die(js::reload('parent'));
 }
コード例 #27
0
ファイル: control.php プロジェクト: ppmon/ppm
 /**
  * Unlink story 
  * 
  * @param  int    $releaseID
  * @param  int    $bugID 
  * @access public
  * @return void
  */
 public function unlinkBug($releaseID, $bugID)
 {
     $this->release->unlinkBug($releaseID, $bugID);
     /* if ajax request, send result. */
     if ($this->server->ajax) {
         if (dao::isError()) {
             $response['result'] = 'fail';
             $response['message'] = dao::getError();
         } else {
             $response['result'] = 'success';
             $response['message'] = '';
         }
         $this->send($response);
     }
     die(js::reload('parent'));
 }
コード例 #28
0
ファイル: control.php プロジェクト: huokedu/zentao
 /**
  * Run case.
  * 
  * @param  int    $runID 
  * @param  String $extras   others params, forexample, caseID=10, version=3
  * @access public
  * @return void
  */
 public function runCase($runID, $caseID = 0, $version = 0)
 {
     if (!empty($_POST)) {
         $this->testtask->createResult($runID);
         if (dao::isError()) {
             die(js::error(dao::getError()));
         }
         echo js::reload('parent');
         die(js::closeWindow());
     }
     if (!$caseID) {
         $run = $this->testtask->getRunById($runID);
     }
     if ($caseID) {
         $run->case = $this->loadModel('testcase')->getById($caseID, $version);
     }
     $this->view->run = $run;
     die($this->display());
 }
コード例 #29
0
ファイル: control.php プロジェクト: XMGmen/zentao
 /** addedbyheng
  * Finish a project.
  * 
  * @param  int    $projectID 
  * @access public
  * @return void
  */
 public function finish($projectID)
 {
     $project = $this->project->getById($projectID);
     if ($project->status != 'done') {
         $this->project->finish($projectID);
     }
     if ($project->type == 'bug' or $project->type == 'task') {
         $confirmNote = 'confirm' . ucfirst($project->type);
         $confirmURL = $this->createLink($project->type, 'view', "id={$project->idvalue}");
         $cancelURL = $this->server->HTTP_REFERER;
         die(js::confirm(sprintf($this->lang->project->{$confirmNote}, $project->idvalue), $confirmURL, $cancelURL, 'parent', 'parent'));
     }
     if (isonlybody()) {
         die(js::reload('parent.parent'));
     }
     die(js::reload('parent'));
 }
コード例 #30
0
ファイル: control.php プロジェクト: XMGmen/zentao
 /**
  * Edit file's name. 
  * 
  * @param  int    $fileID 
  * @access public
  * @return void
  */
 public function edit($fileID)
 {
     if ($_POST) {
         $this->app->loadLang('action');
         $file = $this->file->getByID($fileID);
         $this->dao->update(TABLE_FILE)->set('title')->eq($this->post->fileName)->where('id')->eq($fileID)->exec();
         $extension = "." . $file->extension;
         $actionID = $this->loadModel('action')->create($file->objectType, $file->objectID, 'editfile', '', $this->post->fileName . $extension);
         $changes[] = array('field' => 'fileName', 'old' => $file->title . $extension, 'new' => $this->post->fileName . $extension);
         $this->action->logHistory($actionID, $changes);
         die(js::reload('parent.parent'));
     }
     $this->view->file = $this->file->getById($fileID);
     $this->display();
 }