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


PHP Task::setStatus方法代码示例

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


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

示例1: createTask

 /**
  * @param $taskName
  * @param $taskDesc
  * @param $taskDueDate
  * @param $taskStatus
  * @param null $userId
  * @param null $projectId
  * @return bool
  * @throws \Exception
  */
 public function createTask($taskName, $taskDesc, $taskDueDate, $taskStatus, $userId = null, $projectId = null)
 {
     $task = new Task();
     $task->setTitle($taskName);
     $task->setDescription($taskDesc);
     $task->setDueDate(new \DateTime($taskDueDate));
     $task->setStatus($taskStatus);
     if ($projectId) {
         $project = $this->em->getRepository('AppBundle:Project');
         $task->setProject($project->find($project_id));
     }
     if ($userId) {
         $user = $this->em->getRepository('AppBundle:User');
         $task->setUser($user->find($useId));
     }
     try {
         $this->em->persist($task);
         $this->em->flush();
         return true;
     } catch (\Exception $e) {
         throw $e;
     }
 }
开发者ID:Soolan,项目名称:mava-project,代码行数:33,代码来源:Mava.php

示例2: sendTaskToWorker

 /**
  * Send task over RPC to worker
  * Mark task as in progress nad worker as busy
  * @param  Task   $task
  * @param  Worker $worker
  * @return void
  * @author Andraz <andraz.krascek@gmail.com>
  */
 public function sendTaskToWorker(Task $task, Worker $worker)
 {
     $client = $this->newRpcClient($worker->getHost(), $worker->getport());
     $parameters = [$worker->getId(), $task->getId(), $task->getParameters()];
     $task->setStatus('in_progress');
     $this->storage->saveTask($task);
     $worker->setStatus('busy');
     $this->storage->saveWorker($worker);
     $success = $client->notify('run', $parameters);
     if ($success) {
     }
     return $success;
 }
开发者ID:andrazk,项目名称:queue_manager,代码行数:21,代码来源:Manager.php

示例3: executeAddTask

 public function executeAddTask()
 {
     $project = ProjectPeer::retrieveByUuid($this->getRequestParameter('slug'));
     // TODO: make sure user is a member of project
     $this->forward404Unless($project, 'Project not found, or user is not member, unable to add task');
     $this->forward404Unless($user = sfGuardUserProfilePeer::retrieveByUuid($this->getRequestParameter('task_user'), 'Unable to retrieve user'));
     // TODO: add validation for task input
     $task = new Task();
     $task->setProjectId($project->getId());
     $task->setOwnerId($this->getUser()->getProfile()->getUserID());
     $task->setName($this->getRequestParameter('name', 'Task Name'));
     $task->setDescription($this->getRequestParameter('description', 'Task Description'));
     if ($this->getRequestParameter('begin')) {
         list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('begin'), $this->getUser()->getCulture());
         $task->setBegin("{$y}-{$m}-{$d}");
     }
     if ($this->getRequestParameter('finish')) {
         list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('finish'), $this->getUser()->getCulture());
         $task->setFinish("{$y}-{$m}-{$d}");
     }
     $task->setStatus(sfConfig::get('app_task_status_open'));
     $task->setPriority($this->getRequestParameter('priority'));
     $task->save();
     //if ($user != null) $task->addUser($user->getUserId());
     $task->addUser($user->getUserId());
     $this->redirect('@show_project_tasks?tab=tasks&project=' . $project->getSlug());
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:27,代码来源:actions.class.php

示例4: Event

 if ($description != $task->getDescription()) {
     // save changes
     $oldDescription = $task->getDescription();
     $task->setDescription($description);
     $task->save();
     // log it
     $logEvent = new Event(array('event_type_id' => 'edit_task_description', 'project_id' => $project->getID(), 'user_1_id' => Session::getUserID(), 'item_1_id' => $task->getID(), 'data_1' => $oldDescription, 'data_2' => $description));
     $logEvent->save();
     // set flag
     $modified = true;
 }
 // is status modified?
 if ($status != $task->getStatus()) {
     // save changes
     $oldStatus = $task->getStatus();
     $task->setStatus($status);
     $task->save();
     // log it
     $logEvent = new Event(array('event_type_id' => 'edit_task_status', 'project_id' => $project->getID(), 'user_1_id' => Session::getUserID(), 'item_1_id' => $task->getID(), 'data_1' => $oldStatus, 'data_2' => $status));
     $logEvent->save();
     // set flag
     $modified = true;
 }
 // is num needed modified?
 if ($numNeeded != $task->getNumNeeded()) {
     // save changes
     $oldNumNeeded = $task->getNumNeeded();
     $task->setNumNeeded($numNeeded);
     $task->save();
     // log it
     $logEvent = new Event(array('event_type_id' => 'edit_task_num_needed', 'project_id' => $project->getID(), 'user_1_id' => Session::getUserID(), 'item_1_id' => $task->getID(), 'data_1' => $oldNumNeeded, 'data_2' => $numNeeded));
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:task.process.php

示例5: getTask

 /**
  * Get task by id
  * @param int $id
  * @return Task null
  */
 public function getTask($id)
 {
     $result = $this->db->query("SELECT * FROM tasks WHERE id = {$id} LIMIT 1");
     foreach ($result as $key => $row) {
         $task = new Task();
         $task->setId($row['id']);
         $task->setName($row['name']);
         $task->setParameters($row['parameters']);
         $task->setStatus($row['status']);
         return $task;
     }
     return null;
 }
开发者ID:andrazk,项目名称:queue_manager,代码行数:18,代码来源:SqlStorage.php


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