コード例 #1
0
ファイル: control.php プロジェクト: laiello/zentaoms
 /**
  * Edit a build.
  * 
  * @param  int    $buildID 
  * @access public
  * @return void
  */
 public function edit($buildID)
 {
     if (!empty($_POST)) {
         $changes = $this->build->update($buildID);
         if (dao::isError()) {
             die(js::error(dao::getError()));
         }
         if ($changes) {
             $actionID = $this->loadModel('action')->create('build', $buildID, 'edited');
             $this->action->logHistory($actionID, $changes);
         }
         die(js::locate(inlink('view', "buildID={$buildID}"), 'parent'));
     }
     $this->loadModel('story');
     $this->loadModel('bug');
     $this->loadModel('project');
     /* Set menu. */
     $build = $this->build->getById((int) $buildID);
     $this->project->setMenu($this->project->getPairs(), $build->project);
     /* Get stories and bugs. */
     $orderBy = 'status_asc, stage_asc, id_desc';
     $stories = $this->story->getProjectStories($build->project, $orderBy);
     $bugs = $this->bug->getProjectBugs($build->project);
     /* Assign. */
     $this->view->title = $this->lang->build->edit;
     $this->view->position[] = $this->lang->build->edit;
     $this->view->products = $this->project->getProducts($build->project);
     $this->view->build = $build;
     $this->view->users = $this->loadModel('user')->getPairs('nodeleted', $build->builder);
     $this->view->stories = $stories;
     $this->view->bugs = $bugs;
     $this->view->orderBy = $orderBy;
     $this->display();
 }
コード例 #2
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]);
         }
     }
 }
コード例 #3
0
ファイル: changePassword.php プロジェクト: xupnge1314/project
 /**
  * Change password , if use default password ,go to change
  * 
  * @access public
  * @return void
  */
 public function changePassword()
 {
     if ($this->app->user->account == 'guest') {
         die(js::alert('guest') . js::locate('back'));
     }
     if (!empty($_POST)) {
         $password1 = $_POST['password1'];
         if (!$password1) {
             die(js::error('Please input password!'));
         }
         $isDefult = $this->dao->select('password')->from(TABLE_DEFAULTPASSWORD)->Where('password')->eq($this->post->password1)->fetchAll();
         //如果用户使用默认密码则跳到修改密码界面
         if ($isDefult) {
             die(js::error('Password can not in default list!') . js::locate($this->createLink('my', 'changePassword', 'type=forbidden'), 'parent'));
         }
         $this->user->updatePassword($this->app->user->id);
         if (dao::isError()) {
             die(js::error(dao::getError()));
         }
         die(js::locate($this->createLink('my', 'profile'), 'parent'));
     }
     $this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->changePassword;
     $this->view->position[] = $this->lang->my->changePassword;
     $this->view->user = $this->user->getById($this->app->user->id);
     $this->display();
 }
コード例 #4
0
ファイル: model.php プロジェクト: AlenWon/chanzhieps
 /**
  * Create an order.
  * 
  * @access public
  * @return void
  */
 public function create()
 {
     $order = new stdclass();
     $order->account = $this->app->user->account;
     $order->address = $this->post->deliveryAddress;
     $order->payment = $this->post->payment;
     $order->createdDate = helper::now();
     $order->payStatus = 'not_paid';
     $order->status = 'normal';
     $order->deliveryStatus = 'not_send';
     if ($this->post->createAddress) {
         $address = new stdclass();
         $this->loadModel('address');
         $address->account = $this->app->user->account;
         $address->address = $this->post->address;
         $address->contact = $this->post->contact;
         $address->phone = $this->post->phone;
         $address->zipcode = $this->post->zipcode;
         $this->dao->insert(TABLE_ADDRESS)->data($address)->batchCheck($this->config->address->require->create, 'notempty')->exec();
         if (dao::isError()) {
             return array('result' => 'fail', 'message' => dao::getError());
         }
         $order->address = $address->contact . ' [' . $address->phone . '] ' . $address->address . ' ' . $address->zipcode;
     }
     $this->dao->insert(TABLE_ORDER)->data($order)->autocheck()->batchCheck($this->config->order->require->create, 'notempty')->exec();
     if (dao::isError()) {
         return array('result' => 'fail', 'message' => dao::getError());
     }
     $orderID = $this->dao->lastInsertID();
     $orderProduct = new stdclass();
     $orderProduct->orderID = $orderID;
     /* Save products of the order and compute order amount. */
     $amount = 0;
     foreach ($this->post->product as $product) {
         $product = $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->eq($product)->fetch();
         if (empty($product)) {
             continue;
         }
         $orderProduct->productID = $product->id;
         $orderProduct->productName = $product->name;
         $orderProduct->count = $this->post->count[$product->id];
         $orderProduct->price = $product->promotion > 0 ? $product->promotion : $product->price;
         if (!$orderProduct->price) {
             continue;
         }
         $amount += $orderProduct->price * $orderProduct->count;
         $this->dao->insert(TABLE_ORDERPRODUCT)->data($orderProduct)->autoCheck()->exec();
     }
     /* Check valid products count. */
     $productCout = $this->dao->select("count(*) as count")->from(TABLE_ORDERPRODUCT)->where('orderID')->eq($orderID)->fetch('count');
     if (!$productCout) {
         return array('result' => 'fail', 'message' => $this->lang->order->noProducts);
     }
     $this->dao->update(TABLE_ORDER)->set('amount')->eq($amount)->where('id')->eq($orderID)->exec();
     $this->dao->delete()->from(TABLE_CART)->where('account')->eq($this->app->user->account)->andWhere('product')->in($this->post->product)->exec();
     if (!dao::isError()) {
         return $orderID;
     }
 }
コード例 #5
0
ファイル: control.php プロジェクト: leowh/colla
 /**
  * Install web app. 
  * 
  * @param  int    $webappID 
  * @access public
  * @return void
  */
 public function install($webappID)
 {
     $result = $this->webapp->install($webappID);
     if (dao::isError()) {
         $this->send(array('result' => 'fail', 'message' => dao::getError(), 'locate' => $this->createLink('webapp', 'obtain')));
     }
     $this->send(array('result' => 'success', 'message' => $this->lang->webapp->successInstall, 'locate' => $this->createLink('entry', 'admin'), 'entries' => $this->loadModel('entry')->getJSONEntries()));
 }
コード例 #6
0
ファイル: control.php プロジェクト: laiello/zentaoms
 /**
  * Save search query.
  * 
  * @access public
  * @return void
  */
 public function saveQuery()
 {
     $this->search->saveQuery();
     if (dao::isError()) {
         die(js::error(dao::getError()));
     }
     die('success');
 }
コード例 #7
0
ファイル: control.php プロジェクト: peirancao/chanzhieps
 /**
  * Delete an address.
  * 
  * @param  int    $id 
  * @access public
  * @return void
  */
 public function delete($id)
 {
     $this->dao->delete()->from(TABLE_ADDRESS)->where('id')->eq($id)->andWhere('account')->eq($this->app->user->account)->exec();
     if (dao::isError()) {
         $this->send(array('result' => 'fail', 'message' => dao::getError()));
     }
     $this->send(array('result' => 'success', 'message' => $this->lang->deleteSuccess, 'locate' => inlink('browse')));
 }
コード例 #8
0
ファイル: model.php プロジェクト: wenyinos/chanzhieps
 /**
  * Create an order.
  * 
  * @access public
  * @return void
  */
 public function create()
 {
     $order = fixer::input('post')->add('account', $this->app->user->account)->add('createdDate', helper::now())->add('payStatus', 'not_paid')->add('status', 'normal')->add('deliveryStatus', 'not_send')->add('type', 'shop')->get();
     $address = $this->dao->select('*')->from(TABLE_ADDRESS)->where('id')->eq($this->post->deliveryAddress)->andWhere('account')->eq($this->app->user->account)->fetch();
     $order->address = helper::jsonEncode($address);
     if ($this->post->createAddress) {
         $address = $this->createAddress();
         if (!$address) {
             return array('result' => 'fail', 'message' => dao::getError());
         }
         $order->address = helper::jsonEncode($address);
     }
     $this->dao->insert(TABLE_ORDER)->data($order, 'createAddress,deliveryAddress,phone,contact,zipcode,price,count,product')->autocheck()->batchCheck($this->config->order->require->create, 'notempty')->exec();
     if (dao::isError()) {
         return array('result' => 'fail', 'message' => dao::getError());
     }
     $orderID = $this->dao->lastInsertID();
     $goods = new stdclass();
     $goods->orderID = $orderID;
     if (!$this->post->product) {
         $this->clearOrder($orderID);
         return array('result' => 'fail', 'message' => $this->lang->order->noProducts);
     }
     /* Save products of the order and compute order amount. */
     $amount = 0;
     foreach ($this->post->product as $product) {
         $product = $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->eq($product)->fetch();
         if (empty($product)) {
             continue;
         }
         $goods->productID = $product->id;
         $goods->productName = $product->name;
         $goods->count = $this->post->count[$product->id];
         if (isset($this->config->product->stock) && $this->config->product->stock) {
             if ($product->amount < $goods->count) {
                 $this->clearOrder($orderID);
                 return array('result' => 'fail', 'message' => sprintf($this->lang->order->lowStocks, $goods->productName));
             }
         }
         $goods->price = $product->promotion > 0 ? $product->promotion : $product->price;
         if (!$goods->price) {
             continue;
         }
         $amount += $goods->price * $goods->count;
         $this->dao->insert(TABLE_ORDER_PRODUCT)->data($goods)->autoCheck()->exec();
     }
     /* Check valid products count. */
     $productCout = $this->dao->select("count(*) as count")->from(TABLE_ORDER_PRODUCT)->where('orderID')->eq($orderID)->fetch('count');
     if (!$productCout) {
         return array('result' => 'fail', 'message' => $this->lang->order->noProducts);
     }
     $this->dao->update(TABLE_ORDER)->set('amount')->eq($amount)->where('id')->eq($orderID)->exec();
     $this->dao->delete()->from(TABLE_CART)->where('account')->eq($this->app->user->account)->andWhere('product')->in($this->post->product)->exec();
     if (!dao::isError()) {
         return $orderID;
     }
 }
コード例 #9
0
ファイル: control.php プロジェクト: take7yo/zentaophp
 /**
  * Create an article.
  * 
  * @access public
  * @return void
  */
 public function create()
 {
     if (!empty($_POST)) {
         $blogID = $this->blog->create();
         if (dao::isError()) {
             die(js::error(dao::getError()) . js::locate('back'));
         }
         die(js::locate(inlink('index')));
     }
     $this->view->title = $this->lang->blog->add;
     $this->display();
 }
コード例 #10
0
ファイル: control.php プロジェクト: leowh/colla
 /**
  * Set link for a tag.
  * 
  * @param  int    $tagID 
  * @access public
  * @return void
  */
 public function link($tagID)
 {
     if ($_POST) {
         $this->dao->update(TABLE_TAG)->set('link')->eq($this->post->link)->where('id')->eq($tagID)->exec();
         if (!dao::isError()) {
             $this->send(array('result' => 'success'));
         }
         $this->send(array('result' => 'fail', 'message' => dao::getError()));
     }
     $this->view->tag = $this->dao->select('*')->from(TABLE_TAG)->where('id')->eq($tagID)->fetch();
     $this->display();
 }
コード例 #11
0
ファイル: model.php プロジェクト: pubuim/pubuim-zentao-plugin
 public function setConfig($pubuConfig)
 {
     try {
         $this->loadModel('setting')->setItems('system.pubu', $pubuConfig);
         if (dao::isError()) {
             return dao::getError();
         } else {
         }
     } catch (Exception $err) {
         return $err;
     }
     return true;
 }
コード例 #12
0
ファイル: control.php プロジェクト: leowh/colla
 /**
  * Edit cron. 
  * 
  * @param  int    $cronID 
  * @access public
  * @return void
  */
 public function edit($cronID)
 {
     if ($_POST) {
         $this->cron->update($cronID);
         if (dao::isError()) {
             $this->send(array('result' => 'fail', 'message' => dao::getError()));
         }
         $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('index')));
     }
     $this->view->title = $this->lang->cron->edit . $this->lang->cron->common;
     $this->view->cron = $this->cron->getById($cronID);
     $this->display();
 }
コード例 #13
0
ファイル: control.php プロジェクト: mustafakarali/b2c-1
 /**
  * Set link for a tag.
  * 
  * @param  int    $tagID 
  * @access public
  * @return void
  */
 public function link($tagID)
 {
     if ($_POST) {
         $this->dao->update(TABLE_TAG)->set('link')->eq($this->post->link)->where('id')->eq($tagID)->exec();
         if (!dao::isError()) {
             $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess));
         }
         $this->send(array('result' => 'fail', 'message' => dao::getError()));
     }
     $this->view->title = "<i class='icon-edit'></i> " . $this->lang->tag->editLink;
     $this->view->tag = $this->dao->select('*')->from(TABLE_TAG)->where('id')->eq($tagID)->fetch();
     $this->display();
 }
コード例 #14
0
ファイル: control.php プロジェクト: dyp8848/chanzhieps
 /**
  * Set link for a tag.
  * 
  * @param  int    $tagID 
  * @access public
  * @return void
  */
 public function link($tagID)
 {
     if ($_POST) {
         $link = fixer::input('post')->stripTags('link', $this->config->allowedTags->admin)->get();
         $this->dao->update(TABLE_TAG)->data($link)->autoCheck()->where('id')->eq($tagID)->exec();
         if (!dao::isError()) {
             $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess));
         }
         $this->send(array('result' => 'fail', 'message' => dao::getError()));
     }
     $this->view->title = "<i class='icon-edit'></i> " . $this->lang->tag->editLink;
     $this->view->tag = $this->dao->select('*')->from(TABLE_TAG)->where('id')->eq($tagID)->fetch();
     $this->display();
 }
コード例 #15
0
ファイル: control.php プロジェクト: iamazhi/zentaopms
 /**
  * Execute a module's model's method, return the result.
  * 
  * @param  string    $moduleName 
  * @param  string    $methodName 
  * @param  string    $params        param1=value1,param2=value2, don't use & to join them.
  * @access public
  * @return string
  */
 public function getModel($moduleName, $methodName, $params = '')
 {
     parse_str(str_replace(',', '&', $params), $params);
     $module = $this->loadModel($moduleName);
     $result = call_user_func_array(array(&$module, $methodName), $params);
     if (dao::isError()) {
         die(json_encode(dao::getError()));
     }
     $output['status'] = $result ? 'success' : 'fail';
     $output['data'] = json_encode($result);
     $output['md5'] = md5($output['data']);
     $this->output = json_encode($output);
     die($this->output);
 }
コード例 #16
0
ファイル: control.php プロジェクト: caiwenhao/zentao
 /**
  * Custom 
  * 
  * @param  string $module 
  * @param  string $field 
  * @access public
  * @return void
  */
 public function set($module = 'story', $field = 'priList')
 {
     if ($module == 'user' and $field == 'priList') {
         $field = 'roleList';
     }
     $currentLang = $this->app->getClientLang();
     $this->app->loadLang($module);
     $this->app->loadConfig('story');
     $fieldList = $this->lang->{$module}->{$field};
     if ($module == 'bug' and $field == 'typeList') {
         unset($fieldList['designchange']);
         unset($fieldList['newfeature']);
         unset($fieldList['trackthings']);
     }
     if (!empty($_POST)) {
         if ($module == 'story' && $field == 'review') {
             $this->loadModel('setting')->setItem('system.story.needReview', fixer::input('post')->get()->needReview);
         } else {
             $lang = $_POST['lang'];
             $this->custom->deleteItems("lang={$lang}&module={$module}&section={$field}");
             foreach ($_POST['keys'] as $index => $key) {
                 $value = $_POST['values'][$index];
                 if (!$value or !$key) {
                     continue;
                 }
                 $system = $_POST['systems'][$index];
                 /* the length of role is 20, check it when save. */
                 if ($module == 'user' and $field == 'roleList' and strlen($key) > 20) {
                     die(js::alert($this->lang->custom->notice->userRole));
                 }
                 $this->custom->setItem("{$lang}.{$module}.{$field}.{$key}.{$system}", $value);
             }
         }
         if (dao::isError()) {
             die(js::error(dao::getError()));
         }
         die(js::reload('parent'));
     }
     $this->view->title = $this->lang->custom->common . $this->lang->colon . $this->lang->{$module}->common;
     $this->view->position[] = $this->lang->custom->common;
     $this->view->position[] = $this->lang->{$module}->common;
     $this->view->needReview = $this->config->story->needReview;
     $this->view->fieldList = $fieldList;
     $this->view->dbFields = $this->custom->getItems("lang={$currentLang},all&module={$module}&section={$field}");
     $this->view->field = $field;
     $this->view->module = $module;
     $this->view->currentLang = $currentLang;
     $this->view->canAdd = strpos($this->config->custom->canAdd[$module], $field) !== false;
     $this->display();
 }
コード例 #17
0
ファイル: control.php プロジェクト: XMGmen/zentao
 /**
  * Edit cron. 
  * 
  * @param  int    $cronID 
  * @access public
  * @return void
  */
 public function edit($cronID)
 {
     if ($_POST) {
         $this->cron->update($cronID);
         if (dao::isError()) {
             die(js::error(dao::getError()));
         }
         die(js::locate(inlink('index'), 'parent'));
     }
     $this->view->title = $this->lang->cron->edit . $this->lang->cron->common;
     $this->view->position[] = html::a(inlink('index'), $this->lang->cron->common);
     $this->view->position[] = $this->lang->cron->edit;
     $this->view->cron = $this->cron->getById($cronID);
     $this->display();
 }
コード例 #18
0
ファイル: model.php プロジェクト: hansen1416/eastsoft
 /**
  * Create an consulting.
  * 
  * @param  string $type 
  * @access public
  * @return int|bool
  */
 public function create()
 {
     $now = helper::now();
     $consulting = fixer::input('post')->setDefault('addedDate', $now)->get();
     $consult = $this->dao->select('*')->from(TABLE_CONSULTING)->where('realname')->eq($consulting->realname)->andWhere('mobile')->eq($consulting->mobile)->andWhere('email')->eq($consulting->email)->fetch();
     if ($consult) {
         return array('result' => 'fail', 'message' => '请不要重复提交!<a href="javascript:history.back();">返回</a>');
     } else {
         $this->dao->insert(TABLE_CONSULTING)->data($consulting)->exec();
         $consultingID = $this->dao->lastInsertID();
         if (dao::isError()) {
             return array('result' => 'fail', 'message' => dao::getError());
         }
         return array('result' => 'success', 'message' => '提交成功!');
     }
 }
コード例 #19
0
ファイル: control.php プロジェクト: peirancao/chanzhieps
 /**
  * Build All index. 
  * 
  * @access public
  * @return void
  */
 public function buildIndex($type = 'article', $lastID = '')
 {
     if (helper::isAjaxRequest()) {
         $result = $this->search->buildAllIndex($type, $lastID);
         if (dao::isError()) {
             $this->send(array('result' => 'fail', 'message' => dao::getError()));
         }
         if (isset($result['finished']) and $result['finished']) {
             $this->send(array('result' => 'finished', 'message' => $this->lang->search->buildSuccessfully));
         } else {
             $this->send(array('result' => 'unfinished', 'message' => sprintf($this->lang->search->buildResult, $result['count']), 'next' => inlink('buildIndex', "type={$result['type']}&lastID={$result['lastID']}")));
         }
     }
     $this->view->title = $this->lang->search->buildIndex;
     $this->display();
 }
コード例 #20
0
ファイル: control.php プロジェクト: hansen1416/eastsoft
 /**
  * Buy score use money.
  * 
  * @access public
  * @return void
  */
 public function buyScore()
 {
     if ($this->app->user->account == 'guest') {
         $this->locate($this->createLink('user', 'login'));
     }
     if ($_POST) {
         if ($this->post->amount < $this->config->score->buyScore->minAmount) {
             $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->score->errorAmount, $this->config->score->buyScore->minAmount)));
         }
         $orderID = $this->score->saveOrder();
         if (!$orderID) {
             $this->send(array('result' => 'fail', 'message' => dao::getError()));
         }
         $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('payOrder', "orderID={$orderID}")));
     }
     $this->display();
 }
コード例 #21
0
 public function save()
 {
     if (!empty($_POST)) {
         $pubuConfig = new stdclass();
         $pubuConfig->webhook = trim($this->post->webhook);
         $this->loadModel('setting')->setItems('system.pubu', $pubuConfig);
         if (dao::isError()) {
             var_dump(dao::getError());
             error_log("DaoError: " . dao::getError() . "\n", 3, "/tmp/zentao.log");
             $this->pubu->sendNotification($pubuConfig->webhook, array('type' => 'error', 'data' => array('error' => dao::getError())));
             // die(js::error(dao::getError()));
         }
         $this->session->set('pubuConfig', '');
     }
     $this->view->position[] = html::a(inlink('index'), $this->lang->pubu->common);
     $this->view->position[] = '保存';
     $this->display();
 }
コード例 #22
0
ファイル: control.php プロジェクト: huokedu/zentao
 /**
  * Edit a plan.
  * 
  * @param  int    $planID 
  * @access public
  * @return void
  */
 public function edit($planID)
 {
     if (!empty($_POST)) {
         $changes = $this->productplan->update($planID);
         if (dao::isError()) {
             die(js::error(dao::getError()));
         }
         if ($changes) {
             $actionID = $this->loadModel('action')->create('productplan', $planID, 'edited');
             $this->action->logHistory($actionID, $changes);
         }
         die(js::locate(inlink('view', "planID={$planID}"), 'parent'));
     }
     $plan = $this->productplan->getByID($planID);
     $this->commonAction($plan->product);
     $this->view->header->title = $this->lang->productplan->edit;
     $this->view->position[] = $this->lang->productplan->edit;
     $this->view->plan = $plan;
     $this->display();
 }
コード例 #23
0
ファイル: model.php プロジェクト: huokedu/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->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 = $todos->begins[$i];
             $todo->end = $todos->ends[$i];
             $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]);
         }
     }
 }
コード例 #24
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;
 }
コード例 #25
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'));
     }
 }
コード例 #26
0
ファイル: control.php プロジェクト: XMGmen/zentao
 /**
  * Unlink a story.
  * 
  * @param  int    $projectID 
  * @param  int    $storyID 
  * @param  string $confirm    yes|no
  * @access public
  * @return void
  */
 public function unlinkStory($projectID, $storyID, $confirm = 'no')
 {
     if ($confirm == 'no') {
         echo js::confirm($this->lang->project->confirmUnlinkStory, $this->createLink('project', 'unlinkstory', "projectID={$projectID}&storyID={$storyID}&confirm=yes"));
         exit;
     } else {
         $this->project->unlinkStory($projectID, $storyID);
         /* 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);
         }
         echo js::locate($this->app->session->storyList, 'parent');
         exit;
     }
 }
コード例 #27
0
ファイル: control.php プロジェクト: XMGmen/zentao
 /**
  * Delete a todo.
  * 
  * @param  int    $todoID 
  * @param  string $confirm yes|no
  * @access public
  * @return void
  */
 public function delete($todoID, $confirm = 'no')
 {
     if ($confirm == 'no') {
         echo js::confirm($this->lang->todo->confirmDelete, $this->createLink('todo', 'delete', "todoID={$todoID}&confirm=yes"));
         exit;
     } else {
         $this->dao->delete()->from(TABLE_TODO)->where('id')->eq($todoID)->exec();
         $this->loadModel('action')->create('todo', $todoID, 'erased');
         /* 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::locate($this->session->todoList, 'parent'));
     }
 }
コード例 #28
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'));
 }
コード例 #29
0
ファイル: control.php プロジェクト: iamazhi/zentaopms
 /**
  * Batch change the stage of story.
  * 
  * @param  string    $stage 
  * @access public
  * @return void
  */
 public function batchChangeStage($stage)
 {
     $storyIDList = $this->post->storyIDList ? $this->post->storyIDList : die(js::locate($this->session->storyList, 'parent'));
     $allChanges = $this->story->batchChangeStage($storyIDList, $stage);
     if (dao::isError()) {
         die(js::error(dao::getError()));
     }
     foreach ($allChanges as $storyID => $changes) {
         $actionID = $this->action->create('story', $storyID, 'Edited');
         $this->action->logHistory($actionID, $changes);
         $this->sendmail($storyID, $actionID);
     }
     die(js::locate($this->session->storyList, 'parent'));
 }
コード例 #30
0
ファイル: control.php プロジェクト: lianghaisong/chanzhieps
 /**
  * Batch delete messages.
  * 
  * @access public
  * @return void
  */
 public function batchDelete()
 {
     $messages = $this->post->messages;
     if (empty($messages)) {
         $this->send(array('result' => 'fail', 'message' => $this->lang->message->noSelectedMessage));
     }
     foreach ($messages as $message) {
         $result = $this->message->deleteByAccount($message);
         if (!$result) {
             $this->send(array('result' => 'fail', 'message' => dao::getError()));
         }
     }
     $this->send(array('result' => 'success', 'message' => $this->lang->deleteSuccess, 'locate' => $this->createLink('user', 'message')));
 }