本文整理汇总了PHP中Task::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::get方法的具体用法?PHP Task::get怎么用?PHP Task::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveItem
/**
* (non-PHPdoc)
* @see DetailsPageAbstract::saveItem()
*/
public function saveItem($sender, $param)
{
$results = $errors = array();
try {
Dao::beginTransaction();
$task = null;
if (isset($param->CallbackParameter->id) && !($task = Task::get(trim($param->CallbackParameter->id))) instanceof Task) {
throw new Exception('Invalid Task passed in!');
}
if (!isset($param->CallbackParameter->instructions) || ($instructions = trim($param->CallbackParameter->instructions)) === '') {
throw new Exception('Instructions are required!');
}
if (!isset($param->CallbackParameter->customerId) || !($customer = Customer::get(trim($param->CallbackParameter->customerId))) instanceof Customer) {
throw new Exception('Invalid Customer Passed in!');
}
$tech = isset($param->CallbackParameter->techId) ? UserAccount::get(trim($param->CallbackParameter->techId)) : null;
$order = isset($param->CallbackParameter->orderId) ? Order::get(trim($param->CallbackParameter->orderId)) : null;
$dueDate = new UDate(trim($param->CallbackParameter->dueDate));
$status = isset($param->CallbackParameter->statusId) ? TaskStatus::get(trim($param->CallbackParameter->statusId)) : null;
if (!$task instanceof Task) {
$task = Task::create($customer, $dueDate, $instructions, $tech, $order);
} else {
$task->setCustomer($customer)->setDueDate($dueDate)->setInstructions($instructions)->setTechnician($tech)->setFromEntityId($order instanceof Order ? $order->getId() : '')->setFromEntityName($order instanceof Order ? get_class($order) : '')->setStatus($status)->save();
}
// $results['url'] = '/task/' . $task->getId() . '.html?' . $_SERVER['QUERY_STRING'];
$results['item'] = $task->getJson();
Dao::commitTransaction();
} catch (Exception $ex) {
Dao::rollbackTransaction();
$errors[] = $ex->getMessage();
}
$param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
}
示例2: getAllOutstandingCount
public static function getAllOutstandingCount($user_id)
{
$count = 0;
foreach (TaskList::get($where = array('user_id' => $user_id)) as $tasklist) {
$count += count(Task::get($where = array('list_id' => $tasklist->getId(), 'complete' => '0')));
}
return $count;
}
示例3: catch
function __toString()
{
try {
$this->task->get();
} catch (Exception $e) {
}
return "id => " . $this->id . "<br>" . "start =>" . date("Y/m/d H:i:s", $this->start) . "<br>" . "end =>" . date("Y/m/d H:i:s", $this->end) . "<br>" . "value => " . $this->value . "<br>" . $this->task . "achieveTime => " . $this->achieveTime . "<br>";
}
示例4: addWorkForm
public function addWorkForm()
{
$project = Task::get()->map('ID', 'Title');
DateField::set_default_config('showcalendar', true);
DateField::set_default_config('dateformat', 'dd/MM/YYYY');
$fields = new FieldList(new DropDownField('TaskID', 'Project', $project), new TextField('Title'), new DropDownField("Status", "Status", singleton('Task')->dbObject('Status')->enumValues()), new DateField('Date', 'Date'), new NumericField('HourSpent', 'Time Spent in Hours'));
$actions = new FieldList(new FormAction('doworkadd', 'Submit'));
return new Form($this, 'addWorkForm', $fields, $actions);
}
示例5: __toString
public function __toString()
{
try {
$this->task->get();
$this->user->get();
} catch (Exception $e) {
return "";
}
return 'id = ' . $this->id . "<br>" . '$this->start = ' . $this->start . "<br>" . '$this->end = ' . $this->end . "<br>" . '$this->desc = ' . $this->description . "<br>" . '$this->state = ' . $this->state . "<br>" . '$this->feedback = ' . $this->feedback . "<br>" . $this->task . $this->user;
}
示例6: add
public function add()
{
$this->load->library('jdf');
$this->load->helper('form');
$this->load->library('form_validation');
$this->load->library("session");
if ($this->form_validation->run('item/add') === FALSE) {
$this->load->view("templates/errorForm.php", array("fields" => array('rating', 'isDone', 'task', 'date', 'endTime', 'startTime')));
} else {
$item = new Item();
$task = new Task();
$user = new User($this->session->getStudentId());
if ($this->input->post("isDone") == 1) {
$state = ITEM_STATE_DONE;
} else {
$state = ITEM_STATE_UNDONE;
}
$task->where("user_id", $this->session->getStudentId());
$task->where("id", $this->input->post("task"));
$start = makeTime($this->input->post("date"), $this->input->post("startTime"));
$end = makeTime($this->input->post("date"), $this->input->post("endTime"));
try {
$task->get();
$item->create($start, $end, $this->input->post("description"), $state, $this->input->post("rating"))->save($user, $task);
$this->load->view("item/item_created.php", array("item" => $this->setFormat(array($item))));
} catch (Item_Overlap_With_Other_Item $e) {
$this->load->view("item/item_error.php");
Item_Error::Item_Overlap_With_Other_Item();
} catch (Item_Create_With_Zero_Duration $e) {
$this->load->view("item/item_error.php");
Item_Error::Item_Create_With_Zero_Duration();
} catch (Item_Feedback_Wrong $e) {
$this->load->view("item/item_error.php");
Item_Error::Item_Feedback_Wrong();
} catch (Item_Start_Greater_Than_End_Exception $e) {
$this->load->view("item/item_error.php");
Item_Error::Item_Start_Greater_Than_End_Exception();
} catch (Task_Not_Found $e) {
$this->load->view("task/task_error.php");
}
}
}
示例7: array
</div>
<input type="hidden" name="id" value="<?php
echo $tasklist->getId();
?>
">
</form>
</li>
<?php
$cond_task = array('list_id' => $tasklist->getId());
if (!isset($_GET['show_complete'])) {
$cond_task['complete'] = '0';
}
foreach (Task::get($where = $cond_task, $order = "`pinned` DESC, `complete` ASC") as $task) {
?>
<!--<li class="list-group-item" id="task-<?php
echo $task->getId();
?>
">-->
<li class="list-group-item" <?php
if ($task->getComplete() == 1) {
?>
style="text-decoration:line-through"<?php
}
?>
id="task-<?php
echo $task->getId();
?>
示例8: hasActiveTaskCheckedIn
public function hasActiveTaskCheckedIn($taskid)
{
$Task = new Task($taskid);
return strtotime($Task->get('checkInTime')) - strtotime($Task->get('createdTime')) > 2;
}
示例9: dirname
<?php
/**
* 发微博
* @author 潘洪学 panliu888@gmail.com
* @create_date 2011-10
*/
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'init.php';
Passport::RequireLogin();
$task = new Task();
$id = intval($_GET['id']);
$TEMPLATE['data'] = $data = $task->get($id);
if ($data['uid'] != Passport::GetLoginUid()) {
echo '没有权限!';
exit;
}
switch ($_POST['action']) {
case '修改':
$TEMPLATE['data'] = array_merge($data, $_POST);
if (!validate()) {
} else {
$tableInfo = array('title' => $_POST['title'], 'content' => $_POST['content']);
if ($data['cat'] == 'weibo') {
if ($_FILES['image']['tmp_name']) {
@mkdir(UPLOAD_PATH, 0777, true);
$save_file = $upload_file = UPLOAD_PATH . microtime(true) . '_' . Pinyin::get($_FILES['image']['name']);
move_uploaded_file($_FILES['image']['tmp_name'], $save_file);
$tableInfo['pic'] = $save_file;
}
}
if ($_POST['time'] == 'on') {
示例10: index
/**
* Display a listing of the resource.
* GET /tasks
*
* @return Response
*/
public function index()
{
return Task::get();
}
示例11: actionTask
/**
* Getting the items
*
* @param unknown $sender
* @param unknown $param
* @throws Exception
*
*/
public function actionTask($sender, $param)
{
$results = $errors = array();
try {
Dao::beginTransaction();
if (!isset($param->CallbackParameter->taskId) || !($task = Task::get(trim($param->CallbackParameter->taskId))) instanceof Task) {
throw new Exception('Invalid Task provided!');
}
if (!isset($param->CallbackParameter->method) || ($method = trim(trim($param->CallbackParameter->method))) === '' || !method_exists($task, $method)) {
throw new Exception('Invalid Action Method!');
}
$comments = isset($param->CallbackParameter->comments) ? trim($param->CallbackParameter->comments) : '';
$results['item'] = $task->{$method}(Core::getUser(), $comments)->getJson();
Dao::commitTransaction();
} catch (Exception $ex) {
Dao::rollbackTransaction();
$errors[] = $ex->getMessage();
}
$param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
}
示例12: dirname
* @create_date 2011-10
*/
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'init.php';
Passport::RequireLogin();
$user = new User();
$data = $user->get(Passport::GetLoginUid());
$last_exec = $data['last_exec'];
if (time() - $last_exec > 60 * 60) {
$TEMPLATE['last_exec'] = max($last_exec, 1);
}
$task = new Task();
switch ($_GET['action']) {
case 'send':
$thirdAccount = new ThirdAccount();
$id = intval($_GET['id']);
$item = $task->get($id);
if ($item) {
$type = $item['type'];
$arr = explode('|', $type);
$third = $thirdAccount->getByType($arr[0], $arr[1], $item['uid']);
$api = Factory::CreateAPI2($arr[0], $arr[1], $third);
if ($item['cat'] == 'weibo') {
$ret = $api->upload($item['content'], $item['pic']);
} else {
$ret = $api->publish($item['title'], $item['content']);
}
$TEMPLATE['report'] = array();
$TEMPLATE['report'][$type] = array('id' => $id, 'status' => $ret === true, 'msg' => $ret === true ? '发送成功!<a href="' . $third['url'] . '" target="_blank">查看</a>' : '发送失败:' . $ret);
$task->UpdateStatus($ret === true ? Task::OK : Task::ERROR, $id, $ret, time());
}
break;
示例13: dirname
<?php
/**
* 详细信息
* @author 潘洪学 panliu888@gmail.com
* @create_date 2011-10
*/
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'init.php';
Passport::RequireLogin();
$task = new Task();
$id = intval($_GET['id']);
$TEMPLATE['data'] = $task->get($id);
$TEMPLATE['data']['pic'] = get_pic($TEMPLATE['data']['pic']);
/**
* const OK = 100; // 发送成功
const DELETE_OK = -10; // 取消的
const DELETE_ERR = -20;
const DELETE_TASK = -30;
const ERROR = -1; // 发送失败
const TASK = 0; // 定时任务
const EXECING= 1; // 正在执行任务
const TASK_EDIT = 2; // 修改中
*/
switch ($TEMPLATE['data']['status']) {
case Task::OK:
$TEMPLATE['data']['status_text'] = '发送成功';
break;
case Task::DELETE_OK:
$TEMPLATE['data']['status_text'] = '从发送成功列表删除';
break;
case Task::DELETE_ERR:
示例14: cancel_task
public function cancel_task()
{
// Find
$Task = new Task($this->REQUEST['id']);
// Hook
$this->HookManager->processEvent('TASK_CANCEL', array('Task' => &$Task));
// Force
try {
// Cencel task - will throw Exception on error
$Task->cancel();
// Success
$result['success'] = true;
if ($Task->get('typeID') == 12 || $Task->get('typeID') == 13) {
$Host = new Host($Task->get('hostID'));
$SnapinJob = $Host->getActiveSnapinJob();
$SnapinTasks = $this->getClass('SnapinTaskManager')->find(array('jobID' => $SnapinJob->get('id')));
print $SnapinJob->get('id');
foreach ((array) $SnapinTasks as $SnapinTask) {
$SnapinTask->destroy();
}
$SnapinJob->destroy();
}
if ($Task->get('typeID') == 8) {
$MSA = current($this->getClass('MulticastSessionsAssociationManager')->find(array('taskID' => $Task->get('id'))));
if ($MSA && $MSA->isValid()) {
$MS = new MulticastSessions($MSA->get('msID'));
$MS->set('clients', $MS->get('clients') - 1)->save();
if ($MS->get('clients') <= 0) {
$MS->set('completetime', $this->formatTime('now', 'Y-m-d H:i:s'))->set('stateID', 5)->save();
}
}
}
$Task->cancel();
} catch (Exception $e) {
// Failure
$result['error'] = $e->getMessage();
}
// Output
if ($this->isAJAXRequest()) {
print json_encode($result);
} else {
if ($result['error']) {
$this->fatalError($result['error']);
} else {
$this->FOGCore->redirect(sprintf('?node=%s', $this->node));
}
}
}
示例15: Task
function get_tasks($filter = null)
{
$additional_criteria = '';
if (isset($filter)) {
if ($filter == 'incomplete') {
$additional_criteria = 'AND is_complete = 0';
} else {
if ($filter == 'complete') {
$additional_criteria = 'AND is_complete = 1';
}
}
}
$task = new Task();
$tasks = $task->get(" WHERE project_id = {$this->id} {$additional_criteria}", array('order', 'ASC'));
return $tasks;
}