本文整理汇总了PHP中app\models\Task类的典型用法代码示例。如果您正苦于以下问题:PHP Task类的具体用法?PHP Task怎么用?PHP Task使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Task类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: update
/**
* Update the specified resource in storage via ajax.
*/
public function update(TaskRequest $request, $id)
{
if ($request->ajax()) {
$task = Task::findOrFail($id);
$task->update($request->all());
return $task;
}
return view('errors.404');
}
开发者ID:unclefudge,项目名称:whs,代码行数:12,代码来源:TaskController.php
示例17: destroy
public function destroy()
{
$task = Task::find(Input::get("id"));
if (!$task) {
return response()->json(['status' => 'error', 'msg' => "Invalid task!"]);
}
$task->delete();
return response()->json(['status' => 'success']);
}
开发者ID:devchd,项目名称:todo,代码行数:9,代码来源:TasksController.php
示例18: edit
public function edit($id)
{
$user_group = Auth::user()->user_group_id;
if ($user_group == 1) {
$tasks = Task::with('component', 'module')->get();
foreach ($tasks as &$task) {
$task->list = 1;
$task->view = 1;
$task->add = 1;
$task->edit = 1;
$task->delete = 1;
$task->report = 1;
$task->print = 1;
}
} else {
if ($user_group == $id || $id == 1) {
$tasks = DB::table('user_group_roles as ugr')->select('ugr.component_id', 'ugr.module_id', 'ugr.task_id', 'ugr.list', 'ugr.view', 'ugr.add', 'ugr.edit', 'ugr.delete', 'ugr.report', 'ugr.print', 'components.name_en as component_name', 'modules.name_en as module_name', 'tasks.name_en as task_name')->join('tasks', 'tasks.id', '=', 'ugr.task_id')->join('components', 'components.id', '=', 'ugr.component_id')->join('modules', 'modules.id', '=', 'ugr.module_id')->where('tasks.route', 'not like', 'roles%')->where('ugr.user_group_id', $id)->where('ugr.list', 1)->get();
} else {
$tasks = DB::table('user_group_roles as ugr')->select('ugr.component_id', 'ugr.module_id', 'ugr.task_id', 'ugr.list', 'ugr.view', 'ugr.add', 'ugr.edit', 'ugr.delete', 'ugr.report', 'ugr.print', 'components.name_en as component_name', 'modules.name_en as module_name', 'tasks.name_en as task_name')->join('tasks', 'tasks.id', '=', 'ugr.task_id')->join('components', 'components.id', '=', 'ugr.component_id')->join('modules', 'modules.id', '=', 'ugr.module_id')->where('ugr.user_group_id', $id)->where('ugr.list', 1)->get();
}
}
$roleResult = DB::table('user_group_roles as ugr')->select('ugr.id as ugr_id', 'ugr.list', 'ugr.view', 'ugr.add', 'ugr.edit', 'ugr.delete', 'ugr.report', 'ugr.print', 'ugr.component_id', 'ugr.module_id', 'ugr.task_id')->where('ugr.user_group_id', $id)->orderBy('ugr.component_id', 'asc')->orderBy('ugr.module_id', 'asc')->get();
$roles = new stdClass();
$roles->list = [];
$roles->view = [];
$roles->add = [];
$roles->edit = [];
$roles->delete = [];
$roles->report = [];
$roles->print = [];
$roles->ugr_id = [];
foreach ($roleResult as $result) {
$roles->ugr_id[$result->task_id] = $result->ugr_id;
if ($result->list) {
$roles->list[] = $result->task_id;
}
if ($result->view) {
$roles->view[] = $result->task_id;
}
if ($result->add) {
$roles->add[] = $result->task_id;
}
if ($result->edit) {
$roles->edit[] = $result->task_id;
}
if ($result->delete) {
$roles->delete[] = $result->task_id;
}
if ($result->report) {
$roles->report[] = $result->task_id;
}
if ($result->print) {
$roles->print[] = $result->task_id;
}
}
return view('roles.edit', compact('tasks', 'roles', 'id'));
}
开发者ID:saj696,项目名称:pipe,代码行数:57,代码来源:RolesController.php
示例19: afterSave
public function afterSave($insert, $changed)
{
if ($insert) {
foreach (WorkflowTask::findAll(['workflow_id' => $this->workflow_id]) as $orig) {
$task = new Task();
$skips = ['workflow_task_id', 'workflow_id', 'regist_date', 'update_date'];
foreach (Task::getTableSchema()->columnNames as $cols) {
if (in_array($cols, $skips)) {
continue;
}
$task->{$cols} = $orig->{$cols};
}
$task->user_id = Yii::$app->user->id;
$task->project_id = $this->project_id;
$task->save();
}
}
parent::afterSave($insert, $changed);
}
开发者ID:NikDevPHP,项目名称:yii2,代码行数:19,代码来源:Project.php
示例20: test_completed
public function test_completed()
{
$default = factory(Task::class)->create(['completed' => null]);
$active = factory(Task::class)->create(['completed' => false]);
$inactive = factory(Task::class)->create(['completed' => true]);
$tasks = Task::completed()->lists('id');
$this->assertNotContains($default->id, $tasks);
$this->assertNotContains($active->id, $tasks);
$this->assertContains($inactive->id, $tasks);
}
开发者ID:KMK-ONLINE,项目名称:hack_todo,代码行数:10,代码来源:TaskTest.php
注:本文中的app\models\Task类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论