本文整理汇总了PHP中Tasks::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Tasks::model方法的具体用法?PHP Tasks::model怎么用?PHP Tasks::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tasks
的用法示例。
在下文中一共展示了Tasks::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionMilestonesPending
public function actionMilestonesPending()
{
$Milestones = Milestones::model()->MilestoneWithPendingTasks();
foreach ($Milestones as $milestone) {
$Tasks = Tasks::model()->findTaskByMilestone($milestone->milestone_id);
$str = CBaseController::renderInternal(Yii::app()->params['templatesPath'] . '/milestones/overdueMilestones.php', array('user' => $milestone->Users->completeName, 'tasks' => $Tasks, 'applicationName' => Yii::app()->name, 'applicationUrl' => "http://localhost/celestic/" . Yii::app()->request->baseUrl), true);
$subject = Yii::t('email', 'overdueMilestone');
Yii::import('application.extensions.phpMailer.yiiPhpMailer');
$mailer = new yiiPhpMailer();
$mailer->pushMail($subject, $str, array('name' => $milestone->Users->CompleteName, 'email' => $milestone->Users->user_email), Emails::PRIORITY_NORMAL);
}
}
示例2: actionUpdateScheduleTask
function actionUpdateScheduleTask()
{
if (isset($_POST['task_id'])) {
$task_id = $_POST['task_id'];
$task_start = $_POST['task_start'];
$task_end = $_POST['task_end'];
$model = Tasks::model()->updateSheduleTask($task_id, $task_start, $task_end);
if ($model) {
echo '{"status":"success"}';
} else {
echo '{"status":"fail"}';
}
} else {
echo '{"status":"fail"}';
}
}
示例3: actionEdit_task
/**
*
* Показывает для редактирования и сохраняет задание
*
* @param id
* @return true
*
**/
public function actionEdit_task($id)
{
if (!Yii::app()->my->access("edit")) {
return false;
}
$task = Tasks::model()->findByPk($id);
if (isset($_REQUEST['Tasks'])) {
foreach ($_REQUEST['Tasks'] as $key => $value) {
$task->{$key} = $value;
}
if ($task->save()) {
Yii::app()->notify->add("Задание сохранено. <a href='/task/" . $task->id . "' target='blank'>Перейти к заданию</a>");
} else {
Yii::app()->notify->add("Не удалось сохранить", "danger");
print_r($task->getErrors());
}
}
$this->render("task", array("task" => $task));
}
示例4: fetchTaskByComplete
public function fetchTaskByComplete($condition, $complete = 0, $pagesize = null)
{
if (!empty($condition)) {
$condition .= " AND `allcomplete`=" . $complete;
} else {
$condition = "`allcomplete`=" . $complete;
}
if ($complete == 0) {
$tasks = Tasks::model()->fetchAll(array("condition" => $condition, "order" => "sort ASC"));
$data["todolist"] = CJSON::encode($tasks);
} elseif ($complete == 1) {
$tasks = $this->fetchAllAndPage($condition, $pagesize);
foreach ($tasks["datas"] as $v) {
$subTasks = $this->fetchAll("pid=:pid", array(":pid" => $v["id"]));
$tasks["datas"] = array_merge($tasks["datas"], $subTasks);
}
$data = array("pages" => $tasks["pages"], "todolist" => CJSON::encode($tasks["datas"]));
}
return $data;
}
示例5: getProjectDataEffort
public function getProjectDataEffort()
{
$criteria = new CDbCriteria();
$criteria->select = "COUNT(DISTINCT t.task_id) as total, Status.status_id";
$criteria->condition = "Projects.project_id = :project_id";
$criteria->params = array(':project_id' => Yii::app()->user->getState('project_selected'));
$criteria->group = "Stage.taskStage_id";
$countStages = Tasks::model()->with('Projects', 'Stage')->together()->findAll($criteria);
$totalTareas = 0;
foreach ($countStages as $key) {
$totalTareas += intval($key->total);
}
foreach ($countStages as $key) {
$this->seriesStages[] = array($key->Stage->taskStage_name, round(intval($key->total) / $totalTareas * 100));
}
/*echo "<pre>";
print_r($this->seriesStages);
die("</pre>");*/
//return $this->seriesStages;
}
示例6: getNext
/**
*
* @return int Иденификтор следующего задания
*
**/
public function getNext()
{
static $next = null;
if (isset($next)) {
return $next;
}
//
$course = $this->course;
$tasks = Tasks::model()->findAllByAttributes(array("track" => $course), array("order" => "t.order ASC"));
if (count($tasks) == 0) {
return 0;
}
$last = count($tasks) - 1;
if ($tasks[$last]->id == $this->id) {
$next = 0;
return 0;
}
foreach ($tasks as $i => $task) {
if ($task->id == $this->id) {
$next = $tasks[$i + 1]->id;
return $next;
}
}
}
示例7: getActivity
public function getActivity()
{
return Tasks::model()->findActivity(Yii::app()->user->id);
}
示例8: array
<?php
/* @var $this ProcessChecklistController */
/* @var $model ProcessChecklist */
?>
<!-- ================== TỔNG HỢP CÁC OPEN TASK ĐƯỢC GÁN VÀO NHÂN VIÊN ============== -->
<?php
$generalAP = Tasks::model()->generalAccountProject($account_id);
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'account-resource-report-grid', 'dataProvider' => $model, 'template' => "{items}", 'columns' => array(array('name' => 'project_name', 'type' => 'raw', 'value' => '$data->projects->project_name'), array('name' => 'End', 'type' => 'raw', 'value' => 'Tasks::model()->getStartTaskProject($data->project_id,$data->account_id, 0);', 'footer' => "<b>" . $generalAP['start'] . "</b>"), array('name' => 'Start', 'type' => 'raw', 'value' => 'Tasks::model()->getEndTaskProject($data->project_id,$data->account_id, 0);', 'footer' => "<b>" . $generalAP['end'] . "</b>"), array('name' => 'Total', 'type' => 'raw', 'value' => 'Tasks::model()->calculateTaskOneProject($data->project_id,$data->account_id, 0);', 'footer' => "<b>" . $generalAP['total_task'] . "<b>"))));
?>
<!-------------------- END TỔNG HỢP CÁC OPEN TASK ĐƯỢC GÁN VÀO NHÂN VIÊN ---------------- -->
<!-- ================== TỔNG HỢP KẾ HOACH CỦA NHÂN VIÊN CHO PROJECT ============== -->
<?php
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'account-resource-report-grid', 'dataProvider' => $model, 'template' => "{items}", 'columns' => array(array('name' => 'project_name', 'type' => 'raw', 'value' => '$data->projects->project_name'), array('name' => 'Planned', 'type' => 'raw', 'value' => 'TaskResourcePlan::model()->calculatePlannedTask($data->project_id,$data->account_id);'), array('name' => 'Unplanned', 'type' => 'raw', 'value' => 'TaskResourcePlan::model()->calculateUnplannedTask($data->project_id,$data->account_id);'))));
?>
<!-------------------- END TỔNG HỢP KẾ HOACH CỦA NHÂN VIÊN CHO PROJECT ---------------- -->
示例9: beforeAction
public function beforeAction($action)
{
switch ($action->id) {
case "view":
$response = Tasks::model()->countTasksByProject((int) $_GET['id'], Yii::app()->user->getState('project_selected')) > 0 ? true : false;
break;
case "update":
$response = Tasks::model()->countTasksByProject((int) $_GET['id'], Yii::app()->user->getState('project_selected')) > 0 ? true : false;
break;
case "delete":
$response = Tasks::model()->countTasksByProject((int) $_GET['id'], Yii::app()->user->getState('project_selected')) > 0 ? true : false;
break;
default:
$response = true;
break;
}
if (!$response) {
throw new CHttpException(403, Yii::t('site', '403_Error'));
} else {
return $response;
}
}
示例10: getTaskCounter
/**
* Get item numbers for each task status
* By default project_id is selected
* @return model list of task status counter
*/
public function getTaskCounter()
{
return Tasks::model()->TaskCounter(Yii::app()->user->id, Yii::app()->user->getState('project_selected'));
}
示例11: actionTheory
public function actionTheory($id)
{
$track = Tracks::model()->with("Tasks")->findByPk($id);
$tasks = Tasks::model()->findAllByAttributes(array("track" => $id), array("order" => "t.order"));
$this->render('theory', array('track' => $track, 'tasks' => $tasks));
}
示例12: intval
<?php
$task = Tasks::model()->findByPk($task_id);
$task_assignee = $task_assignee_arr = TaskAssignees::model()->findAll('task_id=' . intval($task_id));
$count_task_assignee = count($task_assignee);
?>
<h3>Task Progress</h3>
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" onclick="AddTaskProcess();return false;">Task Detail</button>
<!-- Modal -->
<div class="modal fade" id="myModal" style="z-index: 0;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Task Details</h4>
<input type="hidden" id="toal_assign_task" value="<?php
echo $count_task_assignee;
?>
" />
</div>
<div class="modal-body" style="max-height: 500px;">
<!-- ==================== SCHEDULE ================================ -->
<div id="tp-schedule" >
<h4>Schedule</h4>
Start: <?php
echo CHtml::textField('tp-shedule-start', date('d-m-Y', strtotime($task->task_start_date)), array('class' => 'span2'));
?>
示例13: calculateLapsed
/**
* % thời gian đã trãi qua của task
* @param type $task_id
* @return type
*/
public function calculateLapsed($task_id)
{
$lapsed = 0;
$task = Tasks::model()->findByPk($task_id);
$date_current = date('Y-m-d');
$date_start = $task->task_start_date;
$date_end = $task->task_end_date;
if ($date_end < $date_start || $date_start > $date_current) {
$lapsed = 0;
} elseif ($date_end == $date_start) {
$lapsed = 100;
} else {
//Sô ngày đã làm.
$actual = (strtotime($date_current) - strtotime($date_start)) / (60 * 60 * 24);
//Số ngày dự kiến
$est = (strtotime($date_end) - strtotime($date_start)) / (60 * 60 * 24);
// % thoi gian da trai qua cua task
$lapsed = $actual / $est;
if ($lapsed > 1) {
$lapsed = 100;
} elseif ($lapsed < 0) {
$lapsed = 0;
} else {
$lapsed = $lapsed * 100;
}
}
return round($lapsed, 1);
}
示例14: getActivity
/**
* Get all task waiting to solve
* By default user_id and project_id
* @return model list of task to solve
*/
public function getActivity()
{
return Tasks::model()->findActivity(Yii::app()->user->id, Yii::app()->user->getState('project_selected'), 10);
}
示例15: calculateUnplannedTask
/**
* Tính tổng số task trong 1 dự án được gán cho nhân viên và chưa được lên kế hoạch
* @param type $project_id
* @param type $accout_id
*/
public function calculateUnplannedTask($project_id, $account_id)
{
$total_task = Tasks::model()->calculateTaskOneProject($project_id, $account_id);
$total_plan = $this->calculatePlannedTask($project_id, $account_id);
$total_unplan = $total_task - $total_plan;
return $total_unplan;
}