本文整理汇总了PHP中Task::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::getName方法的具体用法?PHP Task::getName怎么用?PHP Task::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Add a task to the collection
*
* @param Task $task The task to be added
* @param string $description A short description explaining what the task does.
*/
public function add(Task $task, $description)
{
// Descriptions must be provided!
$description = trim($description);
if (empty($description)) {
throw new \InvalidArgumentException('No description provided for ' . $task->getName());
}
// Add the task to the internal array
$this->_tasks[$task->getName()] = array($description, $task);
}
示例2: testTask
public function testTask()
{
$mock = $this->getMock('stdClass', ['callback']);
$mock->expects($this->exactly(1))->method('callback');
$task = new Task('task_name', function () use($mock) {
$mock->callback();
});
$context = $this->getMockBuilder('Deployer\\Task\\Context')->disableOriginalConstructor()->getMock();
$task->run($context);
$this->assertEquals('task_name', $task->getName());
$task->desc('Task description.');
$this->assertEquals('Task description.', $task->getDescription());
$task->once();
$this->assertTrue($task->isOnce());
$task->onlyOn(['server']);
$this->assertEquals(['server' => 0], $task->getOnlyOn());
$this->assertTrue($task->runOnServer('server'));
$task->onlyOn([]);
$this->assertTrue($task->runOnServer('server'));
$task->onlyOn('server');
$this->assertEquals(['server' => 0], $task->getOnlyOn());
$this->assertTrue($task->runOnServer('server'));
$task->onlyOn();
$this->assertTrue($task->runOnServer('server'));
$task->setPrivate();
$this->assertTrue($task->isPrivate());
}
示例3: addTask
/**
* @param mixed $task
*/
public function addTask(Task $task)
{
if ($this->freePlaceForTasks) {
$this->tasks[] = $task;
$this->setFreePlaceForTasks();
echo $task->getName() . ' is added to tasks', PHP_EOL;
} else {
echo 'You can\'t add more task';
}
}
示例4: addTask
public function addTask(Task $task)
{
if ($this->freePlacesForTask > 0) {
$this->tasks[] = $task;
$this->freePlacesForTask--;
echo $task->getName(), " has been added!", PHP_EOL;
} else {
echo "You can not add new task!", PHP_EOL;
}
}
示例5: open
/**
* Reopen specific object
*
* @param void
* @return null
*/
function open()
{
if ($this->active_task->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if (!$this->active_task->canChangeCompleteStatus($this->logged_user)) {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
if ($this->request->isSubmitted()) {
db_begin_work();
$action = $this->active_task->open($this->logged_user);
if ($action && !is_error($action)) {
db_commit();
if ($this->request->getFormat() == FORMAT_HTML) {
if ($this->request->get('async')) {
$this->smarty->assign(array('_object_task' => $this->active_task));
print tpl_fetch(get_template_path('_task_opened_row', $this->controller_name, RESOURCES_MODULE));
die;
} else {
//flash_success('Task ":name" has been opened', array('name' => str_excerpt($this->active_task->getName(), 80, '...')));
//bof:mod
flash_success('Task ":name" has been opened', array('name' => str_excerpt(strip_tags($this->active_task->getName()), 80, '...')));
//eof:mod
$this->redirectToReferer($this->active_task->getViewUrl());
}
// if
} else {
$this->serveData($this->active_task);
}
// if
} else {
db_rollback();
if ($this->request->getFormat() == FORMAT_HTML) {
if ($this->request->get('async')) {
$this->serveData($action);
} else {
flash_error('Failed to open task ":name"', array('name' => str_excerpt($this->active_task->getName(), 80, '...')));
$this->redirectToReferer($this->active_task->getViewUrl());
}
// if
} else {
$this->httpError(HTTP_ERR_OPERATION_FAILED);
}
// if
}
// if
} else {
$this->httpError(HTTP_ERR_BAD_REQUEST);
}
// if
}
示例6: header
if (!in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1'))) {
echo 'Access denied';
exit;
} else {
header('Content-Type: application/json');
echo $task->getBebrasJson();
exit;
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title><?php
echo $task->getName();
?>
</title>
<?php
echo $task->getStaticResourcesImportHtml(Task::MODULES | Task::CONTENT | Task::SOLUTION);
?>
</head>
<body <?php
echo $task->getBodyParametersHtml();
?>
>
<?php
echo $task->getContent(Task::CONTENT | Task::SOLUTION);
?>
</body>
</html>
示例7: setCurrentTask
/**
* @param Task $currentTask
*/
public function setCurrentTask($currentTask)
{
$this->currentTask = $currentTask;
echo 'Assigning task ' . $this->currentTask->getName() . ' to ' . $this->name . PHP_EOL;
}
示例8: setFormat
private function setFormat($items)
{
$result = array();
/** @var Item $item */
foreach ($items as $item) {
$task = new Task($item->task_id);
$result[] = array("id" => $item->getId(), "day" => strtolower(date("D", $item->getStart())), "startHour" => date("H", $item->getStart()), "startMinute" => date("i", $item->getStart()), "endHour" => date("H", $item->getEnd()), "endMinute" => date("i", $item->getEnd()), "state" => $item->getStateString(), "feedback" => $item->getFeedback(), "title" => $task->getName(), "color" => $task->getColor());
}
return $result;
}
示例9: saveTask
/**
* Save or update task
* @param Task $task
* @return Task
*/
public function saveTask(Task $task)
{
if (is_null($task->getId())) {
$query = $this->db->prepare("INSERT INTO tasks (name, parameters, status) VALUES (?, ?, ?)");
$query->execute([$task->getName(), $task->getParameters(), $task->getStatus()]);
$task->setId($this->db->lastInsertId());
} else {
$query = $this->db->prepare("UPDATE tasks SET name = ?, parameters = ?, status = ? WHERE id = ?");
$query->execute([$task->getName(), $task->getParameters(), $task->getStatus(), $task->getId()]);
}
return $task;
}