本文整理汇总了PHP中Task::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::update方法的具体用法?PHP Task::update怎么用?PHP Task::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update(Project $project, Task $task, Request $request)
{
$this->validate($request, $this->rules);
$input = array_except(Input::all(), '_method');
$task->update($input);
return Redirect::route('projects.tasks.show', [$project->slug, $task->slug])->with('message', 'Task updated.');
}
示例2: handleRequest
protected function handleRequest(array $request)
{
$taskId = $request[self::FIELD_TASK_ID];
$title = $request[self::FIELD_TITLE];
$description = $request[self::FIELD_DESCRIPTION];
Task::update($taskId, $title, $description);
}
示例3: UpdateTask
function UpdateTask($data, $fields)
{
try {
$task = new Task();
$result = $task->update($fields);
return $result;
} catch (Exception $e) {
return array('Exception!! ' => $e->getMessage());
}
}
示例4: Task
function test_Update()
{
//Arrange
$id = 1;
$description = "Wash the dog";
$date_due = "1990-12-11";
$time_due = "09:00:00";
$test_task = new Task($id, $description, $date_due, $time_due);
$test_task->save();
$new_description = "Home stuff";
//Act
$test_task->update($new_description);
//Assert
$this->assertEquals("Home stuff", $test_task->getDescription());
}
示例5: update
public static function update($id)
{
parent::check_logged_in();
$p = $_POST;
// because i am a lazy piece of shit
$task = Task::find($id);
$task->name = $p['name'];
$task->description = $p['description'];
$task->priority = intval($p['priority']);
$task->completed = isset($p['completed']) ? $p['completed'] : false;
$errors = $task->validate();
if (count($errors) > 0) {
View::make('task/edit.html', array('errors' => $errors, 'attributes' => $p, 'title' => 'edit ' . $task->name, 'groups' => Group::all()));
} else {
//$task->update();
Task::update($id);
Redirect::to('/task/' . $task->id, array('message' => 'Task has been modified successfully.'));
}
}
示例6: update
public static function update($id)
{
// push edits to DB
self::check_logged_in();
$params = $_POST;
if (empty($_POST['projects'])) {
$errors[] = 'Select at least one project!';
$projects = '';
} else {
$projects = $_POST['projects'];
}
$attributes = array('id' => $id, 'description' => $params['description'], 'priority' => $params['priority'], 'status' => $params['status'], 'projectids' => $projects);
$task = new Task($attributes);
//$errors = $task->errors();
$errors = $task->validateTask();
if (count($errors) > 0) {
View::make('task/edit.html', array('errors' => $errors, 'attributes' => $attributes));
} else {
self::updateProjectMembership($id, $projects);
$task->update();
Redirect::to('/task/' . $task->id, array('message' => 'Task edited successfully'));
}
}
示例7: testUpdate
function testUpdate()
{
//Arrange
$name = "School stuff";
$id = null;
$test_category = new Category($name, $id);
$test_category->save();
$description = "Wash the dog";
$category_id = $test_category->getId();
$test_task = new Task($description, $id, $category_id);
$test_task->save();
$new_description = "Clean the dog";
//Act
$test_task->update($new_description);
//Assert
$this->assertEquals("Clean the dog", $test_task->getDescription());
}
示例8: updateTaskRows
/**
* updates row tasks from an Task Array
* @param string $aTasks
* @return array
*/
public function updateTaskRows($aTask)
{
foreach ($aTask as $key => $row) {
$oTask = new Task();
if ($oTask->taskExists($row['TAS_UID'])) {
$oTask->remove($row['TAS_UID']);
} else {
$res = $oTask->update($row);
}
}
return;
}
示例9: dirname
<?php
/**
* 发送成功列表
* @author 潘洪学 panliu888@gmail.com
* @create_date 2011-10
*/
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'init.php';
Passport::RequireLogin();
$task = new Task();
switch (strtolower($_GET['action'])) {
case 'del':
$task->UpdateStatus(Task::DELETE_OK, intval($_GET['id']), '已取消');
break;
case 'clear':
$task->update(array('status' => Task::DELETE_OK, 'msg' => '被清空'), array('uid' => Passport::GetLoginUid(), 'status' => Task::OK));
redirect('?');
break;
}
$pager = new Pager($task->GetCount(Task::OK), 20);
$TEMPLATE['list'] = $task->GetList(Task::OK, $pager->offset());
$TEMPLATE['pager'] = $pager->render();
$TEMPLATE['title'] = '已发送';
$TEMPLATE['login_name'] = Passport::GetLoginName();
$TEMPLATE['nav']['list_ok'] = 'current';
$smarty = new Template();
echo $smarty->r('list_ok');
示例10: Teams
} else {
if ($_POST['action'] === "updtask") {
if ($admin === true) {
try {
(new Teams())->login(htmlspecialchars_decode($team->name), $_POST['pass']);
$task = new Task($_POST['id']);
$task->name = $_POST['name'];
$task->desc = $_POST['desc'];
$task->cat = $_POST['cat'];
$task->status = $_POST['status'];
$task->author = $_POST['author'];
$task->solvers = explode(',', $_POST['solvers']);
$task->point = $_POST['point'];
//$task->flag = $_POST['flag'];
$task->link = $_POST['link'];
$task->update();
$success = "HELAL LA GUNCELLEDIN HAYIRLARA VESILE OLUR INS";
} catch (Exception $e) {
$error .= $e->getMessage() . "\n";
}
}
} else {
if ($_POST['action'] === "addtask") {
if ($admin === true) {
try {
(new Teams())->login(htmlspecialchars_decode($team->name), $_POST['pass']);
$task = new Task();
$task->name = $_POST['name'];
$task->desc = implode("<%#:#%>", $_POST['desc']);
$task->cat = $_POST['cat'];
$task->status = $_POST['status'];
示例11: array
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') {
$tableInfo['status'] = Task::TASK;
$tableInfo['send_time'] = strtotime($_POST['send_time']);
}
$task->update($tableInfo, array('id' => $id));
$item = $task->get($id);
$TEMPLATE['report']['edit'] = array('status' => true, 'msg' => '修改成功,<a href="' . $_POST['return_url'] . '"><返回</a>(<span id="countdown">5</span>)
<script>
var countd = 5;
var tt = setInterval(function(){
if (--countd == 0) {
clearInterval(tt);
location = "' . $_POST['return_url'] . '";
return;
}
$("#countdown").text(countd);
}, 1000);
</script>');
if ($_POST['time'] != 'on') {
$arr = explode('|', $item['type']);
示例12: Task
function test_update()
{
$description = "Wash the dog";
$id = 1;
$due_date = "2000-01-01";
$test_task = new Task($description, $id, $due_date);
$test_task->save();
$new_description = "Clean the dog";
$test_task->update($new_description, $due_date, 0);
$this->assertEquals("Clean the dog", $test_task->getDescription());
}
示例13: Configurations
if (isset($aData['SEND_EMAIL'])) {
$aData['TAS_SEND_LAST_EMAIL'] = $aData['SEND_EMAIL'] == 'TRUE' ? 'TRUE' : 'FALSE';
} else {
$aData['TAS_SEND_LAST_EMAIL'] = 'FALSE';
}
//Additional configuration
if (isset($aData['TAS_DEF_MESSAGE_TYPE']) && isset($aData['TAS_DEF_MESSAGE_TEMPLATE'])) {
G::LoadClass('configuration');
$oConf = new Configurations();
$oConf->aConfig = array('TAS_DEF_MESSAGE_TYPE' => $aData['TAS_DEF_MESSAGE_TYPE'], 'TAS_DEF_MESSAGE_TEMPLATE' => $aData['TAS_DEF_MESSAGE_TEMPLATE']);
$oConf->saveConfig('TAS_EXTRA_PROPERTIES', $aData['TAS_UID'], '', '');
unset($aData['TAS_DEF_MESSAGE_TYPE']);
unset($aData['TAS_DEF_MESSAGE_TEMPLATE']);
}
//Validating TAS_ASSIGN_VARIABLE value
if ($aData['TAS_ASSIGN_TYPE'] == 'SELF_SERVICE_EVALUATE') {
$aData['TAS_ASSIGN_TYPE'] = 'SELF_SERVICE';
} else {
$aData['TAS_GROUP_VARIABLE'] = '';
}
$result = $oTask->update($aData);
$response["status"] = "OK";
if ($result == 3) {
$response["status"] = "CRONCL";
}
echo G::json_encode($response);
break;
}
} catch (Exception $oException) {
die($oException->getMessage());
}
示例14: saveProperties
public function saveProperties($param)
{
try {
$result->sucess = true;
$result->msg = '';
switch ($param['type']) {
case 'process':
require_once 'classes/model/ProcessCategory.php';
require_once 'classes/model/CalendarDefinition.php';
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
$process['PRO_UID'] = $param['UID'];
switch ($param['property']) {
case 'Title':
$fieldName = 'PRO_TITLE';
break;
case 'Description':
$fieldName = 'PRO_DESCRIPTION';
break;
case 'Debug':
$fieldName = 'PRO_DEBUG';
$param['value'] = $param['value'] == 'true' ? '1' : '0';
break;
case 'Category':
$fieldName = 'PRO_CATEGORY';
$category = ProcessCategory::loadByCategoryName($param['value']);
$param['value'] = $category[0]['CATEGORY_UID'];
break;
case 'Calendar':
$fieldName = 'PRO_CALENDAR';
$calendar = CalendarDefinition::loadByCalendarName($param['value']);
G::LoadClass("calendar");
$calendarObj = new Calendar();
$calendarObj->assignCalendarTo($process['PRO_UID'], $calendar['CALENDAR_UID'], 'PROCESS');
break;
}
if ($fieldName != 'PRO_CALENDAR') {
$process[$fieldName] = $param['value'];
$oProcessMap->updateProcess($process);
}
break;
case 'task':
require_once 'classes/model/Task.php';
$oTask = new Task();
$task['TAS_UID'] = $param['UID'];
switch ($param['property']) {
case 'Title':
$fieldName = 'TAS_TITLE';
break;
case 'Description':
$fieldName = 'TAS_DESCRIPTION';
break;
case 'Variable for case priority':
$fieldName = 'TAS_PRIORITY_VARIABLE';
break;
case 'Starting Task':
$fieldName = 'TAS_START';
$param['value'] = strtoupper($param['value']);
break;
}
$task[$fieldName] = $param['value'];
print_r($task);
$oTask->update($task);
break;
}
} catch (Exception $e) {
$result->sucess = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);
}
示例15: saveProperties
/**
* Save process and task propeties
*
* @param object $httpData{UID, type, property, value}
*/
public function saveProperties($httpData)
{
switch ($httpData->type) {
case 'process':
require_once 'classes/model/ProcessCategory.php';
require_once 'classes/model/CalendarDefinition.php';
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
$process['PRO_UID'] = $httpData->UID;
switch ($httpData->property) {
case 'Title':
$fieldName = 'PRO_TITLE';
break;
case 'Description':
$fieldName = 'PRO_DESCRIPTION';
break;
case 'Debug':
$fieldName = 'PRO_DEBUG';
$httpData->value = $httpData->value == 'true' ? '1' : '0';
break;
case 'Category':
$fieldName = 'PRO_CATEGORY';
$category = ProcessCategory::loadByCategoryName($httpData->value);
$httpData->value = $category['CATEGORY_UID'];
break;
case 'Calendar':
$fieldName = 'PRO_CALENDAR';
$calendar = CalendarDefinition::loadByCalendarName($httpData->value);
G::LoadClass("calendar");
$calendarObj = new Calendar();
$calendarObj->assignCalendarTo($process['PRO_UID'], $calendar['CALENDAR_UID'], 'PROCESS');
break;
}
if ($fieldName != 'PRO_CALENDAR') {
$process[$fieldName] = $httpData->value;
$oProcessMap->updateProcess($process);
}
break;
case 'task':
require_once 'classes/model/Task.php';
$oTask = new Task();
$task['TAS_UID'] = $httpData->UID;
switch ($httpData->property) {
case 'Title':
$fieldName = 'TAS_TITLE';
break;
case 'Description':
$fieldName = 'TAS_DESCRIPTION';
break;
case 'Variable for case priority':
$fieldName = 'TAS_PRIORITY_VARIABLE';
break;
case 'Starting Task':
$fieldName = 'TAS_START';
$httpData->value = strtoupper($httpData->value);
break;
}
$task[$fieldName] = $httpData->value;
$oTask->update($task);
break;
}
$this->sucess = true;
}