本文整理汇总了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;
}
}
}
示例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]);
}
示例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]);
}
示例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;
}
示例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;
}
示例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)]);
}
示例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";
}
}
示例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');
});
}
示例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;
}
示例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.');
});
}
示例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);
}
示例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();
}
示例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('/');
}
示例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'));
}
示例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();
}