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


PHP common::createChanges方法代码示例

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


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

示例1: update

 /**
  * Update a release.
  * 
  * @param  int    $releaseID 
  * @access public
  * @return void
  */
 public function update($releaseID)
 {
     $oldRelease = $this->getByID($releaseID);
     $release = fixer::input('post')->stripTags('name')->setDefault('stories', '')->setDefault('bugs', '')->join('stories', ',')->join('bugs', ',')->get();
     $this->dao->update(TABLE_RELEASE)->data($release)->autoCheck()->batchCheck($this->config->release->edit->requiredFields, 'notempty')->check('name', 'unique', "id != {$releaseID}")->where('id')->eq((int) $releaseID)->exec();
     $this->dao->update(TABLE_STORY)->set('stage')->eq('released')->where('id')->in($release->stories)->exec();
     if (!dao::isError()) {
         return common::createChanges($oldRelease, $release);
     }
 }
开发者ID:shshenpengfei,项目名称:scrum_project_manage_system,代码行数:17,代码来源:model.php

示例2: update

 public function update($assetID)
 {
     $skipFields = '';
     $skipFields .= $this->loadModel('custom')->dealWithCustomArrayField();
     $oldAsset = $this->getAssetById($assetID);
     $now = helper::now();
     $address = fixer::input('post')->get('address');
     $extendaddress = fixer::input('post')->get('extendaddress');
     $devicenumber = fixer::input('post')->get('devicenumber');
     $code = fixer::input('post')->get('code');
     $module = $this->loadModel('info')->getAllChildId(fixer::input('post')->cleanInt('module')->setDefault('module', 0)->get('module'), 'asset');
     $result1 = $this->dao->select('*')->from(TABLE_INFOASSET)->where('address')->eq($extendaddress)->andWhere('address')->ne('IP Format Error')->andWhere('address')->ne('Conflict!')->andWhere('address')->ne('')->beginIF($module)->andWhere('module')->in($module)->fi()->fetchAll();
     $result2 = $this->dao->select('*')->from(TABLE_INFOASSET)->where('extendaddress')->eq($address)->andWhere('extendaddress')->ne('IP Format Error')->andWhere('extendaddress')->ne('Conflict!')->andWhere('extendaddress')->ne('')->beginIF($module)->andWhere('module')->in($module)->fi()->fetchAll();
     $asset = fixer::input('post')->cleanInt('module')->setDefault('module', 0)->add('lastEditedBy', $this->app->user->account)->add('lastEditedDate', $now)->setDefault('lenddate', '0000-00-00')->setDefault('returndate', '0000-00-00')->setDefault('product', '0')->setDefault('project', '0')->setIF(!(strlen(trim($extendaddress)) == 0) && !validater::checkIP($extendaddress), 'extendaddress', 'IP Format Error')->setIF(!(strlen(trim($address)) == 0) && !validater::checkIP($address), 'address', 'IP Format Error')->removeIF(trim($address) == trim($extendaddress), 'extendaddress')->setIF($result1, 'extendaddress', 'Conflict!')->setIF($result2, 'address', 'Conflict!')->get();
     $condition = "`lib` = '{$asset->lib}' AND module = '{$asset->module}' and id != '{$assetID}'";
     $conditionaddress = $condition . " and address != 'IP Format Error' and address != 'Conflict!'";
     $conditionextaddress = $condition . " and extendaddress != 'IP Format Error' and extendaddress != 'Conflict!'";
     $this->dao->update(TABLE_INFOASSET)->data($asset)->autoCheck($skipFields)->batchCheck($this->config->asset->edit->requiredFields, 'notempty')->check('hostname', 'unique', $condition)->checkIF(!(strlen(trim($address)) == 0), 'address', 'unique', $conditionaddress)->checkIF(!(strlen(trim($extendaddress)) == 0), 'extendaddress', 'unique', $conditionextaddress)->checkIF(!(strlen(trim($devicenumber)) == 0), 'devicenumber', 'unique', $condition)->checkIF(!(strlen(trim($code)) == 0), 'code', 'unique', $condition)->where('id')->eq((int) $assetID)->exec();
     $asset->editedCount = $asset->editedCount - 1;
     if (!dao::isError()) {
         return common::createChanges($oldAsset, $asset);
     }
 }
开发者ID:huokedu,项目名称:zentao,代码行数:23,代码来源:model.php

示例3: updateLib

 public function updateLib($libID, $type)
 {
     $libID = (int) $libID;
     $oldLib = $this->getLibById($libID);
     $lib = fixer::input('post')->stripTags('name')->add('type', $type)->setIF('$defaultlib==on', 'defaultlib', '1')->setIF('$defaultlib==off', 'defaultlib', '0')->get();
     //检测默认库
     $oldDefaultLibID = $this->getDefaultLibId();
     if ($libID == $oldDefaultLibID) {
         $lib->defaultlib = 1;
     } else {
         if ($lib->defaultlib = 1) {
             $this->clearDefaultLib($type);
         }
     }
     $condition = "type = '{$type}' and id != '{$libID}'";
     $this->dao->update(TABLE_INFOLIB)->data($lib)->autoCheck()->batchCheck($this->config->info->editLib->requiredFields, 'notempty')->check('name', 'unique', $condition)->where('id')->eq($libID)->exec();
     if (!dao::isError()) {
         return common::createChanges($oldLib, $lib);
     }
 }
开发者ID:huokedu,项目名称:zentao,代码行数:20,代码来源:model.php

示例4: update

 /**
  * Update a test task.
  * 
  * @param  int   $taskID 
  * @access public
  * @return void
  */
 public function update($taskID)
 {
     $oldTask = $this->getById($taskID);
     $task = fixer::input('post')->stripTags('name')->get();
     $this->dao->update(TABLE_TESTTASK)->data($task)->autoCheck()->batchcheck($this->config->testtask->edit->requiredFields, 'notempty')->where('id')->eq($taskID)->exec();
     if (!dao::isError()) {
         return common::createChanges($oldTask, $task);
     }
 }
开发者ID:huokedu,项目名称:zentao,代码行数:16,代码来源:model.php

示例5: assign

 /**
  * Assign a bug to a user again.
  * 
  * @param  int    $bugID 
  * @access public
  * @return void
  */
 public function assign($bugID)
 {
     $now = helper::now();
     $oldBug = $this->getById($bugID);
     $bug = fixer::input('post')->setDefault('lastEditedBy', $this->app->user->account)->setDefault('lastEditedDate', $now)->remove('comment')->get();
     $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq($bugID)->exec();
     if (!dao::isError()) {
         return common::createChanges($oldBug, $bug);
     }
 }
开发者ID:shshenpengfei,项目名称:scrum_project_manage_system,代码行数:17,代码来源:model.php

示例6: batchClose

 /**
  * Batch close story.
  * 
  * @access public
  * @return void
  */
 public function batchClose()
 {
     /* Init vars. */
     $stories = array();
     $allChanges = array();
     $now = helper::now();
     $storyIDList = $this->post->storyIDList ? $this->post->storyIDList : array();
     /* Adjust whether the post data is complete, if not, remove the last element of $storyIDList. */
     if ($this->session->showSuhosinInfo) {
         array_pop($storyIDList);
     }
     if (!empty($storyIDList)) {
         foreach ($storyIDList as $storyID) {
             $oldStory = $this->getById($storyID);
             $story->lastEditedBy = $this->app->user->account;
             $story->lastEditedDate = $now;
             $story->closedBy = $this->app->user->account;
             $story->closedDate = $now;
             $story->assignedTo = 'closed';
             $story->assignedDate = $now;
             $story->status = 'closed';
             $story->closedReason = $this->post->closedReasons[$storyID];
             $story->duplicateStory = $this->post->duplicateStoryIDList[$storyID] ? $this->post->duplicateStoryIDList[$storyID] : $oldStory->duplicateStory;
             $story->childStories = $this->post->childStoriesIDList[$storyID] ? $this->post->childStoriesIDList[$storyID] : $oldStory->childStories;
             if ($story->closedReason == 'done') {
                 $story->stage = 'released';
             }
             if ($story->closedReason != 'done') {
                 $story->plan = 0;
             }
             $stories[$storyID] = $story;
             unset($story);
         }
         foreach ($stories as $storyID => $story) {
             $oldStory = $this->getById($storyID);
             $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->batchCheck($this->config->story->close->requiredFields, 'notempty')->checkIF($story->closedReason == 'duplicate', 'duplicateStory', 'notempty')->checkIF($story->closedReason == 'subdivided', 'childStories', 'notempty')->where('id')->eq($storyID)->exec();
             if (!dao::isError()) {
                 $allChanges[$storyID] = common::createChanges($oldStory, $story);
             } else {
                 die(js::error('story#' . $storyID . dao::getError(true)));
             }
         }
     }
     return $allChanges;
 }
开发者ID:huokedu,项目名称:zentao,代码行数:51,代码来源:model.php

示例7: close

 /**
  * Close product.
  * 
  * @param  int    $productID.
  * @access public
  * @return void
  */
 public function close($productID)
 {
     $oldProduct = $this->getById($productID);
     $now = helper::now();
     $product = fixer::input('post')->setDefault('status', 'closed')->remove('comment')->get();
     $this->dao->update(TABLE_PRODUCT)->data($product)->autoCheck()->where('id')->eq((int) $productID)->exec();
     if (!dao::isError()) {
         return common::createChanges($oldProduct, $product);
     }
 }
开发者ID:ppmon,项目名称:ppm,代码行数:17,代码来源:model.php

示例8: createFromImport

 /**
  * Create from import 
  * 
  * @param  int    $productID 
  * @access public
  * @return void
  */
 public function createFromImport($productID)
 {
     $this->loadModel('action');
     $this->loadModel('story');
     $this->loadModel('file');
     $now = helper::now();
     $data = fixer::input('post')->get();
     if (!empty($_POST['id'])) {
         $oldSteps = $this->dao->select('t2.*')->from(TABLE_CASE)->alias('t1')->leftJoin(TABLE_CASESTEP)->alias('t2')->on('t1.id = t2.case')->where('t1.id')->in($_POST['id'])->andWhere('t1.product')->eq($productID)->andWhere('t1.version=t2.version')->orderBy('t2.id')->fetchGroup('case');
         $oldCases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($_POST['id'])->fetchAll('id');
     }
     $cases = array();
     foreach ($data->product as $key => $product) {
         $caseData = new stdclass();
         $caseData->product = $product;
         $caseData->module = $data->module[$key];
         $caseData->story = (int) $data->story[$key];
         $caseData->title = $data->title[$key];
         $caseData->pri = (int) $data->pri[$key];
         $caseData->type = $data->type[$key];
         $caseData->status = $data->status[$key];
         $caseData->stage = join(',', $data->stage[$key]);
         $caseData->frequency = 1;
         $caseData->precondition = $data->precondition[$key];
         if (isset($this->config->testcase->create->requiredFields)) {
             $requiredFields = explode(',', $this->config->testcase->create->requiredFields);
             foreach ($requiredFields as $requiredField) {
                 $requiredField = trim($requiredField);
                 if (empty($caseData->{$requiredField})) {
                     die(js::alert(sprintf($this->lang->testcase->noRequire, $key, $this->lang->testcase->{$requiredField})));
                 }
             }
         }
         $cases[$key] = $caseData;
     }
     foreach ($cases as $key => $caseData) {
         if (!empty($_POST['id'][$key])) {
             $caseID = $data->id[$key];
             $stepChanged = false;
             $steps = array();
             $oldStep = isset($oldSteps[$caseID]) ? $oldSteps[$caseID] : array();
             $oldCase = $oldCases[$caseID];
             /* Remove the empty setps in post. */
             $steps = array();
             if (isset($_POST['desc'][$key])) {
                 foreach ($this->post->desc[$key] as $id => $desc) {
                     $desc = trim($desc);
                     if (empty($desc)) {
                         continue;
                     }
                     $step = new stdclass();
                     $step->desc = $desc;
                     $step->expect = trim($this->post->expect[$key][$id]);
                     $steps[] = $step;
                 }
             }
             /* If step count changed, case changed. */
             if (!$oldStep != !$steps or count($oldStep) != count($steps)) {
                 $stepChanged = true;
             } else {
                 /* Compare every step. */
                 foreach ($oldStep as $id => $oldStep) {
                     if (trim($oldStep->desc) != trim($steps[$id]->desc) or trim($oldStep->expect) != $steps[$id]->expect) {
                         $stepChanged = true;
                         break;
                     }
                 }
             }
             $version = $stepChanged ? $oldCase->version + 1 : $oldCase->version;
             $caseData->version = $version;
             $changes = common::createChanges($oldCase, $caseData);
             if (!$changes and !$stepChanged) {
                 continue;
             }
             if ($changes or $stepChanged) {
                 $caseData->lastEditedBy = $this->app->user->account;
                 $caseData->lastEditedDate = $now;
                 $this->dao->update(TABLE_CASE)->data($caseData)->where('id')->eq($caseID)->autoCheck()->exec();
                 if ($stepChanged) {
                     foreach ($steps as $id => $step) {
                         $step = (array) $step;
                         if (empty($step['desc'])) {
                             continue;
                         }
                         $stepData = new stdclass();
                         $stepData->case = $caseID;
                         $stepData->version = $version;
                         $stepData->desc = htmlspecialchars($step['desc']);
                         $stepData->expect = htmlspecialchars($step['expect']);
                         $this->dao->insert(TABLE_CASESTEP)->data($stepData)->autoCheck()->exec();
                     }
                 }
                 $oldCase->steps = $this->joinStep($oldStep);
//.........这里部分代码省略.........
开发者ID:XMGmen,项目名称:zentao,代码行数:101,代码来源:model.php

示例9: batchUpdate

 /**
  * Batch update todos.
  * 
  * @access public
  * @return array
  */
 public function batchUpdate()
 {
     $todos = array();
     $allChanges = array();
     $data = fixer::input('post')->get();
     $todoIDList = $this->post->todoIDList ? $this->post->todoIDList : array();
     /* Adjust whether the post data is complete, if not, remove the last element of $todoIDList. */
     if ($this->session->showSuhosinInfo) {
         array_pop($taskIDList);
     }
     if (!empty($todoIDList)) {
         /* Initialize todos from the post data. */
         foreach ($todoIDList as $todoID) {
             $todo = new stdclass();
             $todo->date = $data->dates[$todoID];
             $todo->type = $data->types[$todoID];
             $todo->pri = $data->pris[$todoID];
             $todo->status = $data->status[$todoID];
             $todo->name = $todo->type == 'custom' ? $data->names[$todoID] : '';
             $todo->begin = $data->begins[$todoID];
             $todo->end = $data->ends[$todoID];
             if ($todo->type == 'task') {
                 $todo->idvalue = isset($data->tasks[$todoID]) ? $data->tasks[$todoID] : 0;
             }
             if ($todo->type == 'bug') {
                 $todo->idvalue = isset($data->bugs[$todoID]) ? $data->bugs[$todoID] : 0;
             }
             $todos[$todoID] = $todo;
         }
         foreach ($todos as $todoID => $todo) {
             $oldTodo = $this->getById($todoID);
             if ($oldTodo->type != 'custom') {
                 $oldTodo->name = '';
             }
             $this->dao->update(TABLE_TODO)->data($todo)->autoCheck()->checkIF($todo->type == 'custom', $this->config->todo->edit->requiredFields, 'notempty')->checkIF($todo->type == 'bug', 'idvalue', 'notempty')->checkIF($todo->type == 'task', 'idvalue', 'notempty')->where('id')->eq($todoID)->exec();
             if ($oldTodo->status != 'done' and $todo->status == 'done') {
                 $this->loadModel('action')->create('todo', $todoID, 'finished', '', 'done');
             }
             if (!dao::isError()) {
                 $allChanges[$todoID] = common::createChanges($oldTodo, $todo);
             } else {
                 die(js::error('todo#' . $todoID . dao::getError(true)));
             }
         }
     }
     return $allChanges;
 }
开发者ID:XMGmen,项目名称:zentao,代码行数:53,代码来源:model.php

示例10: batchUpdate

 /**
  * Batch update plan.
  * 
  * @param  int    $productID 
  * @access public
  * @return array
  */
 public function batchUpdate($productID)
 {
     $data = fixer::input('post')->get();
     $oldPlans = $this->getByIDList($data->id);
     $plans = array();
     foreach ($data->id as $planID) {
         $plan = new stdclass();
         $plan->title = $data->title[$planID];
         $plan->begin = $data->begin[$planID];
         $plan->end = $data->end[$planID];
         if (empty($plan->title)) {
             die(js::alert(sprintf($this->lang->productplan->errorNoTitle, $planID)));
         }
         if (empty($plan->begin)) {
             die(js::alert(sprintf($this->lang->productplan->errorNoBegin, $planID)));
         }
         if (empty($plan->end)) {
             die(js::alert(sprintf($this->lang->productplan->errorNoEnd, $planID)));
         }
         if ($plan->begin > $plan->end) {
             die(js::alert(sprintf($this->lang->productplan->beginGeEnd, $planID)));
         }
         $plans[$planID] = $plan;
     }
     $changes = array();
     foreach ($plans as $planID => $plan) {
         $change = common::createChanges($oldPlans[$planID], $plan);
         if ($change) {
             $this->dao->update(TABLE_PRODUCTPLAN)->data($plan)->autoCheck()->where('id')->eq($planID)->exec();
             if (dao::isError()) {
                 die(js::error(dao::getError()));
             }
             $changes[$planID] = $change;
         }
     }
     return $changes;
 }
开发者ID:ppmon,项目名称:ppm,代码行数:44,代码来源:model.php

示例11: importBug

 /**
  * Import task from Bug. 
  * 
  * @param  int    $projectID 
  * @access public
  * @return void
  */
 public function importBug($projectID)
 {
     $this->loadModel('bug');
     $bugLang = $this->app->loadLang('bug');
     $this->loadModel('task');
     $this->loadModel('story');
     $now = helper::now();
     $BugToTasks = fixer::input('post')->get();
     foreach ($BugToTasks->import as $key => $value) {
         $bug = $this->bug->getById($key);
         $task->project = $projectID;
         $task->story = $bug->story;
         $task->storyVersion = $bug->story;
         $task->fromBug = $key;
         $task->name = $bug->title;
         $task->type = 'devel';
         $task->pri = $BugToTasks->pri[$key];
         $task->consumed = 0;
         $task->status = 'wait';
         $task->statusCustom = strpos(taskModel::CUSTOM_STATUS_ORDER, 'wait') + 1;
         $task->desc = $bugLang->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;
         }
         $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]->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();
         if ($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;
 }
开发者ID:laiello,项目名称:zentaoms,代码行数:69,代码来源:model.php

示例12: update

 /**
  * Update a release.
  * 
  * @param  int    $releaseID 
  * @access public
  * @return void
  */
 public function update($releaseID)
 {
     $oldRelease = $this->getByID($releaseID);
     $branch = $oldRelease->branch;
     if ($oldRelease->build != $this->post->build) {
         $branch = $this->dao->select('branch')->from(TABLE_BUILD)->where('id')->eq($this->post->build)->fetch('branch');
     }
     $release = fixer::input('post')->stripTags($this->config->release->editor->edit['id'], $this->config->allowedTags)->add('branch', (int) $branch)->remove('files,labels,allchecker')->get();
     $release = $this->loadModel('file')->processEditor($release, $this->config->release->editor->edit['id']);
     $this->dao->update(TABLE_RELEASE)->data($release)->autoCheck()->batchCheck($this->config->release->edit->requiredFields, 'notempty')->check('name', 'unique', "id != {$releaseID} AND product = {$release->product} AND deleted = '0'")->where('id')->eq((int) $releaseID)->exec();
     if (!dao::isError()) {
         return common::createChanges($oldRelease, $release);
     }
 }
开发者ID:caiwenhao,项目名称:zentao,代码行数:21,代码来源:model.php

示例13: batchUpdate

 /**
  * Batch update testcases.
  * 
  * @access public
  * @return array
  */
 public function batchUpdate()
 {
     $cases = array();
     $allChanges = array();
     $now = helper::now();
     $caseIDList = $this->post->caseIDList;
     /* Adjust whether the post data is complete, if not, remove the last element of $caseIDList. */
     if ($this->session->showSuhosinInfo) {
         array_pop($caseIDList);
     }
     /* Initialize cases from the post data.*/
     foreach ($caseIDList as $caseID) {
         $case->lastEditedBy = $this->app->user->account;
         $caee->lastEditedDate = $now;
         $case->pri = $this->post->pris[$caseID];
         $case->status = $this->post->statuses[$caseID];
         $case->module = $this->post->modules[$caseID];
         $case->title = htmlspecialchars($this->post->titles[$caseID]);
         $case->type = $this->post->types[$caseID];
         $case->stage = implode(',', $this->post->stages[$caseID]);
         $cases[$caseID] = $case;
         unset($case);
     }
     /* Update cases. */
     foreach ($cases as $caseID => $case) {
         $oldCase = $this->getByID($caseID);
         $this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->edit->requiredFields, 'notempty')->where('id')->eq($caseID)->exec();
         if (!dao::isError()) {
             unset($oldCase->steps);
             $allChanges[$caseID] = common::createChanges($oldCase, $case);
         } else {
             die(js::error('case#' . $caseID . dao::getError(true)));
         }
     }
     return $allChanges;
 }
开发者ID:laiello,项目名称:zentaoms,代码行数:42,代码来源:model.php

示例14: close

 /**
  * Close testtask.
  * 
  * @access public
  * @return void
  */
 public function close($taskID)
 {
     $oldTesttask = $this->getById($taskID);
     $testtask = fixer::input('post')->setDefault('status', 'done')->stripTags($this->config->testtask->editor->close['id'], $this->config->allowedTags)->remove('comment')->get();
     $this->dao->update(TABLE_TESTTASK)->data($testtask)->autoCheck()->where('id')->eq((int) $taskID)->exec();
     if (!dao::isError()) {
         return common::createChanges($oldTesttask, $testtask);
     }
 }
开发者ID:Alfred-Lu,项目名称:zentaopms,代码行数:15,代码来源:model.php

示例15: batchUpdate

 /**
  * Batch update plan.
  * 
  * @param  int    $productID 
  * @access public
  * @return array
  */
 public function batchUpdate($productID)
 {
     $data = fixer::input('post')->skipSpecial('desc')->get();
     $oldPlans = $this->getByIDList($data->id);
     $this->app->loadClass('purifier', true);
     $config = HTMLPurifier_Config::createDefault();
     $config->set('Cache.DefinitionImpl', null);
     $purifier = new HTMLPurifier($config);
     $plans = array();
     foreach ($data->id as $planID) {
         $plan = new stdclass();
         $plan->title = $data->title[$planID];
         $plan->desc = $purifier->purify($data->desc[$planID]);
         $plan->begin = $data->begin[$planID];
         $plan->end = $data->end[$planID];
         if (empty($plan->title)) {
             die(js::alert(sprintf($this->lang->productplan->errorNoTitle, $planID)));
         }
         if (empty($plan->begin)) {
             die(js::alert(sprintf($this->lang->productplan->errorNoBegin, $planID)));
         }
         if (empty($plan->end)) {
             die(js::alert(sprintf($this->lang->productplan->errorNoEnd, $planID)));
         }
         if ($plan->begin > $plan->end) {
             die(js::alert(sprintf($this->lang->productplan->beginGeEnd, $planID)));
         }
         $plans[$planID] = $plan;
     }
     $changes = array();
     foreach ($plans as $planID => $plan) {
         $change = common::createChanges($oldPlans[$planID], $plan);
         if ($change) {
             $this->dao->update(TABLE_PRODUCTPLAN)->data($plan)->autoCheck()->where('id')->eq($planID)->exec();
             if (dao::isError()) {
                 die(js::error(dao::getError()));
             }
             $changes[$planID] = $change;
         }
     }
     return $changes;
 }
开发者ID:jsyinwenjun,项目名称:zentao,代码行数:49,代码来源:model.php


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