當前位置: 首頁>>代碼示例>>PHP>>正文


PHP models\Task類代碼示例

本文整理匯總了PHP中app\models\Task的典型用法代碼示例。如果您正苦於以下問題:PHP Task類的具體用法?PHP Task怎麽用?PHP Task使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Task類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateRowOrder

 protected function updateRowOrder(Task $task, $input)
 {
     if (array_key_exists('order', $input) && array_key_exists('ordertask', $input)) {
         try {
             $task->updateOrder($input['order'], $input['ordertask']);
         } catch (MoveNotPossibleException $e) {
             $result['success'] = false;
             $result['msg'] = "Cannot make a page a child of self.";
             return $result;
         }
     }
 }
開發者ID:BhattaRj,項目名稱:pms,代碼行數:12,代碼來源:TaskRepository.php

示例2: update

 public function update(CreateCommentRequest $request, $id)
 {
     $comment = $this->comment;
     $comment->user_id = $request->get('name');
     $comment->content = $request->get('content');
     $comment->project_id = $id;
     $comment->save();
     $project = Project::whereId($id)->first();
     $slug = $project->slug;
     $task = new Task();
     $tasks = $task->whereProject_id($id)->orderBy('id', 'desc')->first();
     //return view('projects.show', ['project' => $project, 'task' => $tasks]);
     return redirect()->route('projects.show', ['slug' => $slug, 'task' => $tasks]);
 }
開發者ID:berkapavel,項目名稱:Laravel5-Time-Tracker-Project-manager,代碼行數:14,代碼來源:CommentController.php

示例3: actionIndex

 public function actionIndex()
 {
     $user = Yii::$app->user;
     $dashboard = [];
     if ($user->can('partner_view')) {
         $dashboard[] = ['name' => Html::tag('b', __('Partners')), 'link' => Url::to(['partner/index']), 'count' => Partner::find()->count()];
     }
     if ($user->can('visit_view') || $user->can('visit_view_all')) {
         $dashboard[] = ['name' => __('Visits'), 'link' => Url::to(['visit/index']), 'count' => Visit::find()->count()];
     }
     if ($user->can('donate_view') || $user->can('donate_view_all')) {
         $dashboard[] = ['name' => __('Donates'), 'link' => Url::to(['donate/index']), 'count' => Donate::find()->count()];
     }
     if ($user->can('task_view') || $user->can('task_view_all')) {
         $dashboard[] = ['name' => __('Tasks'), 'link' => Url::to(['task/index']), 'count' => Task::find()->count()];
     }
     if ($user->can('newsletter_view')) {
         $dashboard[] = ['name' => __('Mailing lists'), 'link' => Url::to(['mailing-list/index']), 'count' => MailingList::find()->count()];
         $dashboard[] = ['name' => __('Newsletters'), 'link' => Url::to(['newsletter/index']), 'count' => Newsletter::find()->count()];
         $dashboard[] = ['name' => __('Printing templates'), 'link' => Url::to(['print-template/index']), 'count' => PrintTemplate::find()->count()];
     }
     if ($user->can('user_manage')) {
         $dashboard[] = ['name' => __('Users'), 'link' => Url::to(['user/index']), 'count' => User::find()->count()];
     }
     return $this->render('index', ['dashboard' => $dashboard]);
 }
開發者ID:vsguts,項目名稱:crm,代碼行數:26,代碼來源:SiteController.php

示例4: saveAssign

 private function saveAssign($new_assign, $send_notification)
 {
     $model = Task::findOne($this->id);
     $old_assigned = $model->getAssignedToArray();
     if ($old_assigned) {
         if (!$new_assign) {
             return self::deleteAssign($old_assigned);
         }
         //remove elementos a mais
         $to_delete = array_diff($old_assigned, $new_assign);
         if ($to_delete && !self::deleteAssign($to_delete)) {
             return false;
         }
         $to_create = array_diff($new_assign, $old_assigned);
         if ($to_create && !self::createAssign($to_create, $send_notification)) {
             return false;
         }
     } else {
         if ($new_assign) {
             //Cria novo
             return self::createAssign($new_assign, $send_notification);
         }
     }
     return true;
 }
開發者ID:afernandes465,項目名稱:memoboard,代碼行數:25,代碼來源:Task.php

示例5: down

 public function down()
 {
     $this->dropColumn(Project::tableName(), 'keep_version_num');
     $this->dropColumn(Task::tableName(), 'enable_rollback');
     echo "m151027_063246_keep_version_num was reverted.\n";
     return true;
 }
開發者ID:9618211,項目名稱:walle-web,代碼行數:7,代碼來源:m151027_063246_keep_version_num.php

示例6: actionDashboard

 public function actionDashboard()
 {
     $searchModel = new WindowSearch();
     $searchModel->dateFrom = date('Y-m-d');
     $searchModel->dateTo = date('Y-m-d');
     $dataProvider = $searchModel->search(Yii::$app->request->post());
     // eagerly load process info
     $dataProvider->query->with('process');
     $from = strtotime('today', $searchModel->timestampFrom);
     $to = strtotime('tomorrow', $searchModel->timestampTo);
     $processList = StatsHelper::getProcessList($from, $to);
     $this->view->registerJs('var dashboardProcess = ' . json_encode($processList), View::POS_HEAD);
     $timeline = StatsHelper::timeline($from, $to);
     $this->view->registerJs('var dashboardTimeline = ' . json_encode($timeline), View::POS_HEAD);
     $this->view->registerAssetBundle(ColorStripAsset::className());
     // Durations split by process
     $durations = StatsHelper::getProcessWindowHierarchy($from, $to);
     $this->view->registerJs('var dashboardDurations = ' . json_encode($durations), View::POS_HEAD);
     $this->view->registerAssetBundle(SunburstAsset::className());
     // Durations split by task
     $durations = StatsHelper::getTaskWindowHierarchy($from, $to);
     $this->view->registerJs('var dashboardTaskDurations = ' . json_encode($durations), View::POS_HEAD);
     // Keys
     $keysActivity = StatsHelper::keysActivity($from, $to);
     $this->view->registerJs('var dashboardKeys = ' . json_encode($keysActivity), View::POS_HEAD);
     $this->view->registerAssetBundle(KeysAsset::className());
     $this->view->registerAssetBundle(KeysAreaAsset::className());
     $this->clusterChart($searchModel);
     $tasks = array_map(function ($task) {
         return ['id' => $task->id, 'name' => $task->name];
     }, Task::find()->all());
     $this->view->registerJs('var dashboardTasks = ' . json_encode($tasks), View::POS_HEAD);
     $this->view->registerAssetBundle(DashboardAsset::className());
     return $this->render('dashboard', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel, 'totalActivity' => StatsHelper::totalActivity($from, $to)]);
 }
開發者ID:alxkolm,項目名稱:php-selftop,代碼行數:35,代碼來源:SummaryController.php

示例7: actionView

 /**
  *
  */
 public function actionView()
 {
     /** @var User[] $users */
     $users = User::find()->all();
     /** @var Task[] $tasks */
     $tasks = Task::find()->all();
     foreach ($users as $user) {
         echo 'Username : ' . $user->username . "\n";
         echo 'TimeZone : ' . $user->timeZone . "\n";
         echo 'Tasks : ' . "\n";
         foreach ($tasks as $task) {
             echo "\t" . 'Task : ' . $task->title . "\n";
             \Yii::$app->formatter->timeZone = 'UTC';
             echo "\t" . 'Time UTC start : ' . \Yii::$app->formatter->asDatetime($task->timeStart) . "\n";
             echo "\t" . 'Time UTC end : ' . \Yii::$app->formatter->asDatetime($task->timeEnd) . "\n\n";
             \Yii::$app->formatter->timeZone = $user->timeZone;
             echo "\t" . 'Time ' . $user->timeZone . ' start : ' . \Yii::$app->formatter->asDatetime($task->timeStart) . "\n";
             echo "\t" . 'Time ' . $user->timeZone . ' end : ' . \Yii::$app->formatter->asDatetime($task->timeEnd) . "\n";
             echo "\t--------\n";
             // timestamp wont change if we apply timezone
             //                $date = new \DateTime();
             //                $date->setTimestamp($task->timeStart);
             //                $date->setTimezone(new \DateTimeZone($user->timeZone));
             //                echo $task->timeStart . ' => ' . $date->getTimestamp() . "\n"; // same timestamp
         }
         echo "=========== \n";
     }
 }
開發者ID:sergey-program,項目名稱:test-tasks,代碼行數:31,代碼來源:TasksController.php

示例8: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $tasks = \App\Models\Task::all();
     foreach ($tasks as $task) {
         $startTime = strtotime($task->start_time);
         if (!$task->time_log || !count(json_decode($task->time_log))) {
             $task->time_log = json_encode([[$startTime, $startTime + $task->duration]]);
             $task->save();
         } elseif ($task->getDuration() != intval($task->duration)) {
             $task->time_log = json_encode([[$startTime, $startTime + $task->duration]]);
             $task->save();
         }
     }
     Schema::table('tasks', function ($table) {
         $table->dropColumn('start_time');
         $table->dropColumn('duration');
         $table->dropColumn('break_duration');
         $table->dropColumn('resume_time');
     });
     Schema::table('users', function ($table) {
         $table->boolean('dark_mode')->default(false)->nullable();
     });
     Schema::table('users', function ($table) {
         $table->dropColumn('theme_id');
     });
 }
開發者ID:magicians,項目名稱:invoiceninja,代碼行數:31,代碼來源:2015_07_08_114333_simplify_tasks.php

示例9: search

 public function search($params, $dueDateOperator = null, $dueDate = null, $inCompleted = false)
 {
     $query = Task::find();
     $query->joinWith(["milestone.project", "milestone", "user"]);
     if (Yii::$app->user->identity->isViewingProject) {
         $query->andWhere(["project.id" => Yii::$app->user->identity->fkIDWithProjectID]);
     }
     if ($dueDateOperator != null && $dueDate != null) {
         $query->andWhere("task.dueDate " . $dueDateOperator . " '" . $dueDate . "'");
     }
     if ($inCompleted) {
         $query->andWhere(["task.completed" => 0]);
     }
     $activeDataProvider = new ActiveDataProvider(["query" => $query, "pagination" => ["pageSize" => 20]]);
     $activeDataProvider->sort->attributes["userFullName"] = ["asc" => ["user.fullName" => SORT_ASC], "desc" => ["user.fullName" => SORT_DESC]];
     $activeDataProvider->sort->attributes["projectName"] = ["asc" => ["project.name" => SORT_ASC], "desc" => ["project.name" => SORT_DESC]];
     $activeDataProvider->sort->attributes["milestoneName"] = ["asc" => ["milestone.name" => SORT_ASC], "desc" => ["milestone.name" => SORT_DESC]];
     if (!$this->load($params) || !$this->validate()) {
         if (Yii::$app->user->identity->defaultTasksAssignedToMe) {
             $this->userFullName = Yii::$app->user->id;
         }
         return $activeDataProvider;
     }
     $query->andFilterWhere(["like", "task.id", $this->id])->andFilterWhere(["like", "task.name", $this->name])->andFilterWhere(["like", "user.id", $this->userFullName])->andFilterWhere(["like", "project.name", $this->projectName])->andFilterWhere(["like", "milestone.name", $this->milestoneName])->andFilterWhere(["like", "task.dueDate", !empty($this->dueDate) ? Yii::$app->formatter->asDate($this->dueDate, "Y-MM-dd") : null])->andFilterWhere(["like", "task.completed", $this->completed]);
     return $activeDataProvider;
 }
開發者ID:JamesBarnsley,項目名稱:Neptune,代碼行數:26,代碼來源:TaskSearch.php

示例10: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $tasks = Task::where('date', '>=', Carbon::parse(date('d-m-Y')))->where('date', '<=', Carbon::parse(date('d-m-Y'))->addDay(7))->orderBy('date', 'asc')->get();
     \Mail::send('emails.remainder', ['tasks' => $tasks], function ($m) {
         $m->to(env('REMAINDER_EMAIL'), env('REMAINDER_NAME'))->subject('[SUN TASK] Your Task Reminder.');
     });
 }
開發者ID:princesust,項目名稱:SUN-TASK,代碼行數:12,代碼來源:Remainder.php

示例11: index

 /**
  * 顯示當前課程列表
  * @author FuRongxin
  * @date    2016-03-29
  * @version 2.0
  * @return  \Illuminate\Http\Response 教師課程列表
  */
 public function index()
 {
     $tasks = Task::with(['course' => function ($query) {
         $query->select('kch', 'kcmc', 'xs');
     }])->whereJsgh(Auth::user()->jsgh)->whereNd(session('year'))->whereXq(session('term'))->orderBy('kcxh')->get();
     $title = session('year') . '年度' . Term::find(session('term'))->mc . '學期';
     return view('tes.index')->withTitle($title . '課程列表')->withTasks($tasks);
 }
開發者ID:rxfu,項目名稱:teacher,代碼行數:15,代碼來源:TesController.php

示例12: getTasksNearest

 /**
  * Returns first nearest tasks
  * @param int $iTotalCount if provided total count will be returned to this value
  * @return Task[]
  */
 public static function getTasksNearest(&$iTotalCount = 0)
 {
     $query = Task::find()->where(['closed' => 0])->orderBy('date')->limit(10);
     if (func_num_args()) {
         $iTotalCount = $query->count();
     }
     return $query->andWhere('date')->all();
 }
開發者ID:sapozhkov,項目名稱:goal,代碼行數:13,代碼來源:Dashboard.php

示例13: databaseReset

 /**
  * To reset database
  *
  * @param $key
  *
  * @return \Laravel\Lumen\Http\Redirector
  */
 public function databaseReset($key)
 {
     if (env('APP_DATA_RESET_KEY') == $key) {
         Task::truncate();
         return redirect('/');
     }
     return redirect('/');
 }
開發者ID:princesust,項目名稱:SUN-TASK,代碼行數:15,代碼來源:ResetController.php

示例14: monitoring

 public function monitoring()
 {
     //print_r(auth()->user());
     $page = 2;
     $tasks = Task::query()->paginate($page);
     $links = $tasks->render();
     return view('front.task.monitoring', compact('tasks', 'links'));
 }
開發者ID:zrcing,項目名稱:APM,代碼行數:8,代碼來源:TaskController.php

示例15: postCreate

 public function postCreate(Request $request)
 {
     $input = $request->only(['name']);
     $input['user_id'] = Auth::id();
     $input['course_id'] = Auth::user()->course_id;
     Task::create($input);
     flash()->message('Zadanie bolo vytvorené');
     return redirect()->back();
 }
開發者ID:psiskova,項目名稱:blog-academy,代碼行數:9,代碼來源:TaskController.php


注:本文中的app\models\Task類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。