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


PHP Task::model方法代码示例

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


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

示例1: actionEvents

 public function actionEvents()
 {
     /**
      * @var $task Task
      * @var $cmd CDbCommand
      */
     $result = array('success' => 1);
     if (isset($_GET['from']) && isset($_GET['to'])) {
         $start = date(Task::DF_INTER, intval($_GET['from']) / 1000);
         $end = date(Task::DF_INTER, intval($_GET['to']) / 1000);
         //echo $start."\n".$end;
         $criteria = new CDbCriteria();
         $criteria->addBetweenCondition('start_date', $start, $end);
         if ($this->_user()->role == User::ROLE_USER) {
             $cmd = Yii::app()->db->createCommand();
             $taskIds = $cmd->select('task_id')->from(Job::model()->tableName())->where('organization_id = :id AND (updated_at BETWEEN :start AND :end)', array(':id' => $this->_user()->organization_id, ':start' => $start, ':end' => $end))->queryColumn();
             $criteria->addInCondition('id', $taskIds);
         }
         $tasks = Task::model()->findAll($criteria, array('order' => array('priority' => 'DESC')));
         $data = array();
         foreach ($tasks as $task) {
             $data[] = array('id' => $task->id, 'title' => $task->name, 'url' => Yii::app()->createUrl('task/view', array('id' => $task->id)), 'start' => strtotime($task->created_at) . '000', 'end' => strtotime($task->created_at) + 1800 . '000', 'class' => 'priority-' . $task->priority);
         }
         $result['result'] = $data;
     }
     $this->renderJSON($result);
 }
开发者ID:nsarvar,项目名称:performance,代码行数:27,代码来源:CalendarController.php

示例2: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $model = new Task();
     $tasks = Task::model()->findAllByAttributes(array('owner' => Yii::app()->user->id));
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $this->render('index', array('model' => $model, 'tasks' => $tasks));
 }
开发者ID:nterms,项目名称:taskpage,代码行数:12,代码来源:SiteController.php

示例3: getJob

 /**
  * @param $jobId
  * @return null|JobInterface
  */
 public function getJob($jobId)
 {
     /**
      * @var JobIdentity $identity
      */
     $identity = JobIdentity::model()->findByPk($jobId);
     return $this->createJob($identity);
 }
开发者ID:xamin123,项目名称:code-example,代码行数:12,代码来源:Factory.php

示例4: loadModel

 private function loadModel($id)
 {
     $task = Task::model()->findByPk($id);
     if (!$task) {
         $this->sendResponse(array(), 404, array('Task not found.'));
     }
     return $task;
 }
开发者ID:moohwaan,项目名称:yii-application-cookbook-2nd-edition-code,代码行数:8,代码来源:TodoController.php

示例5: accessEditProject

 /**
  * Получает доступ к редактированию проекту если:
  * Администратор, содатель проекта, участник конкретного действия.
  * @param type $projectID
  * @return boolean
  */
 public static function accessEditProject($projectID, $taskId = NULL)
 {
     if (self::currentUserIsAdmin()) {
         return true;
     }
     if (!is_null(Project::model()->find(array('select' => 'id', 'condition' => 'id=:id AND user_id=:user_id', 'params' => array(':id' => $projectID, ':user_id' => Yii::app()->user->getId()))))) {
         return true;
     }
     if (!is_null($taskId) && !is_null(Task::model()->find(array('select' => 'id', 'condition' => 'id=:id  AND project_id=:project_id AND executor=:user_id', 'params' => array(':id' => $taskId, ':project_id' => $projectID, ':user_id' => Yii::app()->user->getId()))))) {
         return true;
     }
     return false;
 }
开发者ID:nunomorgado,项目名称:ghant,代码行数:19,代码来源:ProjectHelper.php

示例6: actionAjaxList

 /**
  * Query for calendar
  */
 public function actionAjaxList($start, $end)
 {
     $user_id = Yii::app()->user->getId();
     $conditionDate = '(start_date < :end AND end_date > :start)';
     if (Yii::app()->db->driverName == 'sqlite') {
         $conditionDate = '(date(start_date) < date(:end) AND date(end_date) > date(:start))';
     }
     $tasks = Task::model()->findAll(array('condition' => $conditionDate . ' AND (project.user_id = :user_id OR t.executor =:user_id1 )', 'params' => array(':end' => date('Y-m-d', $end), ':start' => date('Y-m-d', $start), ':user_id' => $user_id, ':user_id1' => $user_id), 'with' => array('project' => array('select' => 'user_id'))));
     $data = array();
     foreach ($tasks as $task) {
         $data[] = array('title' => $task->description, 'start' => strtotime($task->start_date), 'end' => strtotime($task->end_date), 'url' => $this->createUrl('/project/view', array('id' => $task->project_id)));
     }
     echo CJSON::encode($data);
     Yii::app()->end();
 }
开发者ID:nunomorgado,项目名称:ghant,代码行数:18,代码来源:ProjectController.php

示例7: actionViewlog

 public function actionViewlog($id)
 {
     $this->layout = '//layouts/column1';
     if (!Yii::app()->user->checkAccess('Admin')) {
         throw new CHttpException(403, 'You are not authorized to perform this action.');
     }
     $model = Task::model()->findByPk($id);
     $tasklog = new TaskLog('search');
     $tasklog->unsetAttributes();
     if (isset($_GET['TaskLog'])) {
         $tasklog->attributes = $_GET['TaskLog'];
         if (isset($_GET['TaskLog']['date_search']) && $_GET['TaskLog']['date_search'] != '') {
             $tasklog->date = date('Y-m-d', strtotime($_GET['TaskLog']['date_search']));
         }
     }
     $this->render('viewlog', array('tasklog' => $tasklog, 'model' => $model));
 }
开发者ID:vietbunder,项目名称:ptracker,代码行数:17,代码来源:TaskLogController.php

示例8: print_task

function print_task($tasks)
{
    $id = 1;
    foreach ($tasks as $task) {
        $childcount = Task::model()->count(array('condition' => 'parent_id=' . $task->id . ' AND deleted=0'));
        $assignment = TaskAssignment::model()->find(array('condition' => 'task_id=' . $task->id . ' AND deleted=0'));
        if ($childcount > 0) {
            $childtasks = Task::model()->findAll(array('condition' => 'parent_id=' . $task->id . ' AND deleted=0'));
            echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '", "' . $task->title . '", "' . date('m/d/Y', strtotime($task->start_date)) . '", "' . date('m/d/Y', strtotime($task->due_date)) . '", "659af7", "#", 0, "' . (isset($assignment) ? $assignment->member->username : '') . '", 0, 1, ' . ($task->has_parent ? $task->parent_id : 0) . ', 0));';
            print_task($childtasks);
        } else {
            echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '", "' . $task->title . '", "' . date('m/d/Y', strtotime($task->start_date)) . '", "' . date('m/d/Y', strtotime($task->due_date)) . '", "659af7", "#", 0, "' . (isset($assignment) ? $assignment->member->username : '') . '", 0, 0, ' . ($task->has_parent ? $task->parent_id : 0) . ', 0));';
            // set criteria for tasklog
            $criteria = new CDbCriteria();
            $criteria->with = array('taskAssignment.task');
            $criteria->order = 'date ASC';
            $criteria->condition = 'type="Project" AND task.id=' . $task->id . ' AND t.deleted=0 and task.deleted=0';
            $criteria2 = new CDbCriteria();
            $criteria2->with = array('taskAssignment.task');
            $criteria2->condition = 'type="Non-project" AND t.member_id=' . $assignment->member_id . ' AND t.deleted=0 AND t.date BETWEEN "' . $task->start_date . '" AND "' . $task->due_date . '"';
            $criteria3 = new CDbCriteria();
            $criteria3->with = array('taskAssignment.task');
            $criteria3->condition = 'type="Project" AND t.member_id=' . $assignment->member_id . ' AND t.deleted=0 AND t.date BETWEEN "' . $task->start_date . '" AND "' . $task->due_date . '"';
            // Merge criteria
            $criteria->mergeWith($criteria2, 'OR');
            $criteria->mergeWith($criteria3, 'OR');
            // Get tasklog based on criteria
            $tasklog = TaskLog::model()->findAll($criteria);
            if ($tasklog) {
                echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '.1", "' . $task->title . ' - REAL", "", "", "fe7e7e", "#", 0, "-", 0, 1, ' . ($task->has_parent ? $task->parent_id : 0) . ', 0));';
                foreach ($tasklog as $item) {
                    if ($item->type == "Non-project") {
                        echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '.' . $item->id . '", "' . $item->date . ' - ' . $item->task_title . ' (Non-project)", "' . date('m/d/Y', strtotime($item->date)) . '", "' . date('m/d/Y', strtotime($item->date)) . '", "737070", "#", 0, "' . $item->member->username . '", 0, 0, "' . $task->id . '.1", "' . $task->title . '-REAL", 0));';
                    } else {
                        if ($item->type == "Project" && $item->taskAssignment->task->id != $task->id) {
                            echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '.' . $item->id . '", "' . $item->date . ' - ' . $item->taskAssignment->task->title . ' (Different project)", "' . date('m/d/Y', strtotime($item->date)) . '", "' . date('m/d/Y', strtotime($item->date)) . '", "737070", "#", 0, "' . $item->member->username . '", 0, 0, "' . $task->id . '.1", "' . $task->title . '-REAL", 0));';
                        } else {
                            echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '.' . $item->id . '", "' . $item->date . '", "' . date('m/d/Y', strtotime($item->date)) . '", "' . date('m/d/Y', strtotime($item->date)) . '", "fe7e7e", "#", 0, "' . $item->member->username . '", 0, 0, "' . $task->id . '.1", "' . $task->title . '-REAL", 0));';
                        }
                    }
                }
            }
        }
    }
}
开发者ID:vietbunder,项目名称:ptracker,代码行数:45,代码来源:timetable.php

示例9: loadIdentities

 private function loadIdentities()
 {
     $model = JobIdentity::model();
     $criteria = new \CDbCriteria();
     $criteria->addCondition('broker_name = :name');
     $criteria->addCondition('routing_key = :key');
     $criteria->addCondition('status = ' . JobInterface::IS_NEW);
     $criteria->order = 'task_id';
     $criteria->limit = 5;
     //1000; todo
     $criteria->params = [':name' => $this->broker->getName(), ':key' => $this->routingKey];
     /**
      * @var JobIdentity[] $identities
      */
     $identities = $model->findAll($criteria);
     $identityIds = [];
     foreach ($identities as $identity) {
         $this->identities[$identity->getId()] = $identity;
         $identityIds[] = $identity->getId();
     }
     $model->updateByPk($identityIds, ['status' => JobInterface::SCHEDULED]);
 }
开发者ID:xamin123,项目名称:code-example,代码行数:22,代码来源:RouteBrokerReader.php

示例10: init

 public function init()
 {
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenATaskIsCompleted()) {
         $eventHandler = array($this, 'updateContactLatestActivityDateTimeByTask');
         Task::model()->attachEventHandler('onAfterSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['Task'] = array('onAfterSave', $eventHandler);
     }
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenANoteIsCreated()) {
         $eventHandler = array($this, 'updateContactLatestActivityDateTimeByNote');
         Note::model()->attachEventHandler('onAfterSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['Note'] = array('onAfterSave', $eventHandler);
     }
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenAnEmailIsSentOrArchived()) {
         $eventHandler = array($this, 'updateContactLatestActivityDateTimeByEmailMessage');
         EmailMessage::model()->attachEventHandler('onAfterSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['EmailMessage'] = array('onAfterSave', $eventHandler);
     }
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenAMeetingIsInThePast()) {
         $eventHandler = array($this, 'resolveModelLatestActivityDateTimeProcessFlagByMeeting');
         Meeting::model()->attachEventHandler('onBeforeSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['Meeting'] = array('onBeforeSave', $eventHandler);
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:23,代码来源:ContactLatestActivityDateTimeObserver.php

示例11: getIdentity

 /**
  * @return JobIdentity
  */
 protected function getIdentity()
 {
     return $this->identity = JobIdentity::model()->findByPk($this->getId());
 }
开发者ID:xamin123,项目名称:code-example,代码行数:7,代码来源:Job.php

示例12: getAttributeData

 /**
  * Returns data array of the attribute for create/update.
  * @param string the attribute name
  * @return array the attribute's data
  */
 public function getAttributeData($attribute)
 {
     switch ($attribute) {
         case 'billedM':
         case 'spentM':
             $minutes = range(0, 60, 5);
             if (ctype_digit((string) $this->{$attribute}) && $this->{$attribute} >= 0 && $this->{$attribute} <= 60 && !in_array($this->{$attribute}, $minutes)) {
                 $minutes[] = $this->{$attribute};
                 sort($minutes);
             }
             $retval = array();
             foreach ($minutes as $minute) {
                 $retval[$minute] = sprintf('%02u', $minute);
             }
             return $retval;
         case 'consultantId':
             return array(null => Yii::t('t', '- Please select -')) + CHtml::listData(User::model()->findAllActiveRecords(array($this->{$attribute})), 'id', 'screenName');
         case 'isConfirmed':
             return array(null => Yii::t('attr', 'By default (The record is not confirmed by the project manager)'), self::IS_NOT_CONFIRMED => Yii::t('attr', 'No (The record is not confirmed by the project manager)'), self::IS_CONFIRMED => Yii::t('attr', 'Yes (The record is confirmed by the project manager)'));
         case 'managerId':
             return array(null => Yii::t('t', '- Please select -')) + CHtml::listData(User::model()->findAllActiveRecords(array($this->{$attribute})), 'id', 'screenName');
         case 'taskId':
             return array(null => Yii::t('t', '- Please select -')) + CHtml::listData(Task::model()->findAllOpenRecords(array($this->{$attribute})), 'id', 'title');
         default:
             return $this->{$attribute};
     }
 }
开发者ID:megabr,项目名称:web3cms,代码行数:32,代码来源:Time.php

示例13: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Task::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:BGCX067,项目名称:fairytask-svn-to-git,代码行数:13,代码来源:TaskController.php

示例14: array

<?php

/* @var $this TaskController */
/* @var $model Task */
// Making task array
$task = $model;
$links = array();
$links = array_merge(array($task->title), $links);
while ($task->has_parent) {
    $task = Task::model()->findByPk($task->parent_id);
    $links = array_merge(array($task->title => array('task/view', 'id' => $task->id)), $links);
}
$links = array_merge(array($model->project->name => array('project/view', 'id' => $model->project_id)), $links);
$links = array_merge(array('Projects' => array('project/index')), $links);
// Displaying breadcrumbs
$this->widget('booster.widgets.TbBreadcrumbs', array('links' => $links));
$this->menu = array(array('label' => 'See my projects', 'url' => array('project/myProjects')), array('label' => 'See all projects', 'url' => array('project/index')), array('label' => 'Add task', 'url' => array('task/create', 'id' => $model->project_id)), array('label' => 'Update task', 'url' => array('task/update', 'id' => $model->id)));
?>
<h2 class="page-header">Task Detail : <?php 
echo $model->title;
?>
</h2>
<?php 
$this->widget('booster.widgets.TbDetailView', array('id' => 'task-detail', 'data' => $model, 'attributes' => array('project.name', array('label' => 'Parent Task', 'value' => $model->has_parent == 0 ? '-' : $model->parent->title), array('label' => 'Creator', 'value' => $model->creator->username), array('label' => 'Assigned to', 'value' => TaskAssignment::model()->find(array('condition' => 'task_id=' . $model->id . ' AND deleted=0')) ? TaskAssignment::model()->find(array('condition' => 'task_id=' . $model->id . ' AND deleted=0'))->member->username : '-'), array('label' => 'Start date', 'value' => date('d-m-Y', strtotime($model->start_date))), array('label' => 'Due date', 'value' => date('d-m-Y', strtotime($model->due_date))), array('label' => 'Status', 'value' => $model->status))));
?>

<!-- Display current status -->
<!--<h4>
    <b>Current Status :</b>
    <?php 
/*$model->status=="New" ? $this->widget('booster.widgets.TbLabel', array('context' => 'default','label' => 'NEW')) : 
开发者ID:vietbunder,项目名称:ptracker,代码行数:31,代码来源:view.php

示例15: userAllTasks

 public function userAllTasks(User $user)
 {
     $criteria = new CDbCriteria();
     $criteria->alias = 'job';
     $criteria->select = 'task.user_id as task_user_id, task.name as name, task.number as number, task.priority as priority, user.name as user_name, job.*';
     $criteria->join = 'LEFT JOIN ' . Task::model()->tableName() . ' on task.id = job.task_id
                          LEFT JOIN ' . User::model()->tableName() . ' on user.id = task.user_id';
     $criteria->compare('job.organization_id', $user->organization_id);
     if ($this->number) {
         $criteria->compare('task.number', $this->number);
     }
     if ($this->period_id) {
         $criteria->compare('task.period_id', $this->period_id);
     }
     if ($this->priority) {
         $criteria->compare('task.priority', $this->priority);
     }
     if ($this->status) {
         $criteria->compare('job.status', $this->status);
     }
     return new CActiveDataProvider(Job::model(), array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'task.period_id DESC, job.status ASC, task.priority DESC', 'route' => "task/user", 'attributes' => array('priority' => array('asc' => 'task.priority', 'desc' => 'task.priority DESC'), 'name' => array('asc' => 'task.name', 'desc' => 'task.name DESC'), 'number' => array('asc' => 'task.number', 'desc' => 'task.number DESC'), 'user_name' => array('asc' => 'user.name', 'desc' => 'user.name DESC'), '*')), 'pagination' => array('pageSize' => 20, 'route' => "task/user")));
 }
开发者ID:nsarvar,项目名称:performance,代码行数:22,代码来源:Job.php


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