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


PHP Task::setName方法代码示例

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


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

示例1: run

 public function run($siteID, $args)
 {
     Task::setName('Calendar Reminders');
     Task::setDescription('Send out reminder e-mails from the CATS calendar.');
     $calendar = new Calendar(0);
     //Check for reminders that need to be sent out.
     $dueEvents = $calendar->getAllDueReminders();
     // Do/log nothing if no events exist
     if (!count($dueEvents)) {
         return TASKRET_SUCCESS_NOLOG;
     }
     foreach ($dueEvents as $index => $data) {
         $emailSubject = 'CATS Event Reminder: ' . $data['title'];
         $emailContents = $GLOBALS['eventReminderEmail'];
         $stringsToFind = array('%FULLNAME%', '%NOTES%', '%EVENTNAME%', '%DUETIME%');
         $replacementStrings = array($data['enteredByFirstName'] . ' ' . $data['enteredByLastName'], $data['description'], $data['title'], self::_getReminderTimeString($data['reminderTime']));
         $emailContents = str_replace($stringsToFind, $replacementStrings, $emailContents);
         $emailDestination = $data['reminderEmail'];
         // SEND E-Mail here
         $calendar->sendEmail($data['siteID'], 0, $emailDestination, $emailSubject, $emailContents);
         // Remove alert.
         $calendar->updateEventDisableReminder($data['eventID']);
     }
     // Set the response the task wants logged
     $this->setResponse(sprintf('E-mailed %d calendar reminders.', count($dueEvents)));
     return TASKRET_SUCCESS;
 }
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:27,代码来源:Reminders.php

示例2: run

 public function run($siteID, $args)
 {
     Task::setName('Sphinx Rebuild, Delta, Status');
     Task::setDescription('Rebuilds the index, the delta and status of Sphinx indexer.');
     $response = 'The following tasks were completed successfully: ';
     // Nightly Rebuild of entire Sphinx index at 01:00AM CST
     if (self::getHour() == 1 && self::getMinute() == 0) {
         if (!system($script = sprintf('%s/scripts/sphinx_rotate.sh', ASPUtility::getEnvironmentValue('CATS_PATH')), $result)) {
             $this->setResponse(sprintf('Unable to execute "%s": ', $script) . $result);
             return TASKRET_ERROR;
         }
         $response .= ' * Rebuilt the entire Sphinx index';
     }
     // Check Sphinx Status every 5 minutes
     if (!(self::getMinute() % 5)) {
         if (!system($script = sprintf('%s %s/scripts/sphinxtest.php', ASPUtility::getEnvironmentValue('PHP_PATH'), ASPUtility::getEnvironmentValue('CATS_PATH')), $result)) {
             $this->setResponse(sprintf('Unable to execute "%s": ', $script) . $result);
             return TASKRET_ERROR;
         }
         if (!system($script = sprintf('%s/scripts/sphinx_restart.sh', ASPUtility::getEnvironmentValue('CATS_PATH')), $result)) {
             $this->setResponse(sprintf('Unable to execute "%s": ', $script) . $result);
             return TASKRET_ERROR;
         }
         $response .= ' * Checked Sphinx status';
     }
     // Update Sphinx DELTA index every minute
     if (!system($script = sprintf('%s/scripts/sphinx_update_delta.sh', ASPUtility::getEnvironmentValue('CATS_PATH')), $result)) {
         $this->setResponse(sprintf('Unable to execute "%s": ', $script) . $result);
         return TASKRET_ERROR;
     }
     $response .= ' * Updated the Delta';
     $this->setResponse($response);
     return TASKRET_SUCCESS;
 }
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:34,代码来源:Sphinx.php

示例3: run

 public function run($siteID, $args)
 {
     Task::setName('CleanExceptions');
     Task::setDescription('Clean up the exceptions log.');
     $db = DatabaseConnection::getInstance();
     $sql = sprintf("DELETE FROM\n                exceptions\n             WHERE\n                DATEDIFF(NOW(), exceptions.date) > %s", EXCEPTIONS_TTL_DAYS);
     if (!($rs = $db->query($sql))) {
         $message = 'Query "' . $sql . '" failed!';
         $ret = TASKRET_ERROR;
     } else {
         $num = $db->getAffectedRows();
         if ($num > 0) {
             $message = 'Cleaned up ' . number_format($num, 0) . ' exception logs.';
             $ret = TASKRET_SUCCESS;
         } else {
             // Do not log if nothing was done
             $message = 'No logs were cleaned.';
             $ret = TASKRET_SUCCESS_NOLOG;
         }
     }
     // Set the response the task wants logged
     $this->setResponse($message);
     // Return one of the above TASKRET_ constants.
     return $ret;
 }
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:25,代码来源:CleanExceptions.php

示例4: createTasksFromData

 public static function createTasksFromData($data, $week = null)
 {
     $result = array();
     foreach ($data as $index => $taskArray) {
         $task = new Task();
         $task->setTime($taskArray['time']);
         $task->setName($taskArray['name']);
         $task->setIndex($index);
         $task->setWeek($week);
         $result[$index] = $task;
     }
     return $result;
 }
开发者ID:tymiles003,项目名称:PHP-MyTimesheet,代码行数:13,代码来源:Task.php

示例5: run

 public function run($siteID, $args)
 {
     Task::setName('Sample Non-Recurring Task');
     Task::setDescription('This is the description of this sample task.');
     /**
      * The following are the possible return values of this function.
      * You should put the code you want to run in this function.
      */
     switch (rand(0, 3)) {
         /**
          * TASKRET_ERROR
          *   This task will not be attempted again. It will be marked as an error
          *   and the development team will be notified.
          */
         case 0:
             $message = 'Error';
             $ret = TASKRET_ERROR;
             break;
             /**
              * TASKRET_FAILURE
              *   This task will be tried again a few times. If it continues to fail, it
              *   will be marked as an error (see above).
              */
         /**
          * TASKRET_FAILURE
          *   This task will be tried again a few times. If it continues to fail, it
          *   will be marked as an error (see above).
          */
         case 1:
             $message = 'Failure (will try again)';
             $ret = TASKRET_FAILURE;
             break;
             /**
              * TASKRET_SUCCESS
              *   This task completed successfully and will be logged.
              */
         /**
          * TASKRET_SUCCESS
          *   This task completed successfully and will be logged.
          */
         case 2:
             $message = 'Success';
             $ret = TASKRET_SUCCESS;
             break;
             /**
              * TASKRET_SUCCESS_NOLOG
              *   The task completed successfully but will not save a log.
              */
         /**
          * TASKRET_SUCCESS_NOLOG
          *   The task completed successfully but will not save a log.
          */
         default:
             $message = 'Success (no log)';
             $ret = TASKRET_SUCCESS_NOLOG;
             break;
     }
     // Set the response the task wants logged
     $this->setResponse($message);
     // Return one of the above TASKRET_ constants.
     return $ret;
 }
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:62,代码来源:SampleTask.php

示例6: 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

示例7: 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

示例8: importPendingEmailToTaskList


//.........这里部分代码省略.........
                     //EOF:mod 20121107
                 //BOF:mod 20121107
                 /*
                 //EOF:mod 20121107
                 case 'PRIORITY_ONGOING':
                 	$priority_val = '-3';
                 	$priority_val_set = true;
                 	break;
                 //BOF:mod 20121107
                 */
                 //EOF:mod 20121107
                 case 'PRIORITY_LOWEST':
                     $priority_val = '-2';
                     $priority_val_set = true;
                     break;
                 case 'PRIORITY_LOW':
                     $priority_val = '-1';
                     $priority_val_set = true;
                     break;
                 case 'PRIORITY_NORMAL':
                     $priority_val = '0';
                     $priority_val_set = true;
                     break;
                 case 'PRIORITY_HIGH':
                     $priority_val = '1';
                     $priority_val_set = true;
                     break;
                 case 'PRIORITY_HIGHEST':
                     $priority_val = '2';
                     $priority_val_set = true;
                     break;
                     //BOF:mod 20121107
                 //BOF:mod 20121107
                 case 'PRIORITY_URGENT':
                     $priority_val = '3';
                     $priority_val_set = true;
                     break;
                     //EOF:mod 20121107
             }
             if ($priority_val_set) {
                 $task->setPriority($priority_val);
             }
         }
     }
     $task->setName($incoming_mail->getSubject());
     $amended_body = '';
     //BOF:mod 20120820
     if (empty($comment)) {
         if (strpos($incoming_mail->getSubject(), '{') !== false) {
             $amended_body .= substr($incoming_mail->getSubject(), 0, strrpos($incoming_mail->getSubject(), '{'));
         } else {
             $amended_body .= $incoming_mail->getBody();
         }
     } else {
         if (strpos($incoming_mail->getSubject(), '{') !== false) {
             $parent = $comment->getParent();
             $url = $parent->getViewUrl() . '#comment' . $comment->getId();
             $amended_body .= substr($incoming_mail->getSubject(), 0, strrpos($incoming_mail->getSubject(), '{')) . '<br/><a href="' . $url . '">View Task in Full</a>';
         } else {
             $temp_body = strip_tags($incoming_mail->getBody());
             $chars_len = strlen($temp_body);
             //if ($chars_len > 150){
             if ($chars_len > 525) {
                 //mysql_query("insert into testing (date_added, content) values (now(), 'greater than 150 block')");
                 //$url = $comment->getRealViewUrl();
                 $parent = $comment->getParent();
                 $url = $parent->getViewUrl() . '#comment' . $comment->getId();
                 //mysql_query("insert into testing (date_added, content) values (now(), '" . mysql_real_escape_string($url) . "')");
                 //$amended_body .= substr($temp_body, 0, 150) . '.. <br/><a href="' . $url . '">View Task in Full</a>';
                 $amended_body .= substr($temp_body, 0, 525) . '.. <br/><a href="' . $url . '">View Task in Full</a>';
             } else {
                 $amended_body .= $incoming_mail->getBody();
             }
         }
         //mysql_query("insert into testing (date_added, content) values (now(), '" . mysql_real_escape_string($amended_body) . "')");
         $attachments = $comment->getAttachments();
         if (is_foreachable($attachments)) {
             $amended_body .= '<br/>Attachments:<br/>';
             foreach ($attachments as $attachment) {
                 $amended_body .= '<a href="' . $attachment->getViewUrl() . '">' . $attachment->getName() . '</a><br/>';
             }
         }
     }
     $task->setBody($amended_body);
     //IncomingMailImporter::attachFilesToProjectObject($incoming_mail, $task);
     $save = $task->save();
     if ($save && !is_error($save)) {
         //$subscibed_users = array($project->getLeaderId());
         //if (instance_of($user, 'User')) {
         // $subscibed_users[] = $user->getId();
         //} // if
         //Subscriptions::subscribeUsers($subscibed_users, $ticket);
         $task->ready();
         //mysql_query("insert into testing (date_added, content) values (now(), 'in task list adde func end: " . $task->getId() . "')");
         return $task;
     }
     // if
     return $save;
     //mysql_close($link);
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:IncomingMailImporter.class.php


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