本文整理汇总了PHP中Tasks类的典型用法代码示例。如果您正苦于以下问题:PHP Tasks类的具体用法?PHP Tasks怎么用?PHP Tasks使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tasks类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* AjaxTaskController constructor.
* @param Site $site Site object
* @param array $post $_POST
* @param array $session $_SESSION
*/
public function __construct(Site $site, $post, &$session)
{
$tasks = new Tasks($site);
if (isset($post['getTask'])) {
$id = strip_tags($post['id']);
$task = $tasks->getTaskById($id);
if ($task !== null) {
$this->result = json_encode(array('ok' => true, 'title' => $task->getTitle(), 'notes' => $task->getNotes(), 'priority' => $task->getPriority(), 'day' => $task->getDay()));
return;
}
$this->result = json_encode(array('ok' => false, 'message' => 'Task not found'));
}
}
示例2: executeGoto
public function executeGoto(sfWebRequest $request)
{
$q = Doctrine_Core::getTable('Tasks')->createQuery('t')->leftJoin('t.TasksPriority tp')->leftJoin('t.TasksStatus ts')->leftJoin('t.TasksLabels tl')->leftJoin('t.TasksTypes tt')->leftJoin('t.TasksGroups tg')->leftJoin('t.ProjectsPhases pp')->leftJoin('t.Versions v')->leftJoin('t.Projects p')->leftJoin('t.Users');
$q->addWhere('projects_id=?', $request->getParameter('projects_id'));
if (Users::hasAccess('view_own', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
$q = Tasks::addFiltersToQuery($q, $this->getUser()->getAttribute('tasks_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
$q = app::addListingOrder($q, 'tasks', $this->getUser(), (int) $request->getParameter('projects_id'));
$this->menu = array();
$tasks_ids = array();
foreach ($q->fetchArray() as $tasks) {
if (strlen($sn = app::getArrayName($tasks, 'TasksStatus')) > 0) {
$sn = $sn . ': ';
} else {
$sn = '';
}
if ($request->getParameter('tasks_id') == $tasks['id']) {
$tasks['name'] = '<b>' . $tasks['name'] . '</b>';
}
$this->menu[] = array('title' => $sn . $tasks['name'], 'url' => 'tasksComments/index?projects_id=' . $request->getParameter('projects_id') . '&tasks_id=' . $tasks['id']);
$tasks_ids[] = $tasks['id'];
}
$current_key = array_search($request->getParameter('tasks_id'), $tasks_ids);
$this->previous_tasks_id = false;
$this->next_tasks_id = false;
if (isset($tasks_ids[$current_key - 1])) {
$this->previous_tasks_id = $tasks_ids[$current_key - 1];
}
if (isset($tasks_ids[$current_key + 1])) {
$this->next_tasks_id = $tasks_ids[$current_key + 1];
}
}
示例3: frosso_project_tab_handle_on_project_tabs
/**
* Handle on prepare project overview event
*
* @param NamedList $tabs
* @param User $logged_user
* @param Project $project
* @param array $tabs_settings
* @param string $interface
*/
function frosso_project_tab_handle_on_project_tabs(&$tabs, &$logged_user, &$project, &$tabs_settings, $interface)
{
if ($interface == AngieApplication::INTERFACE_DEFAULT && Tasks::canAccess($logged_user, $project, false) && in_array('fred_pt', $tabs_settings)) {
$tabs->addBefore('fred_pt', array('text' => "Fred PT", 'url' => Router::assemble('frosso_tab_route', array('project_slug' => $project->getSlug())), 'icon' => $interface == AngieApplication::INTERFACE_DEFAULT ? AngieApplication::getImageUrl('icons/16x16/tasks-tab-icon.png', TASKS_MODULE) : AngieApplication::getImageUrl('icons/listviews/tasks.png', TASKS_MODULE, AngieApplication::INTERFACE_PHONE)), 'calendar');
}
// if
}
示例4: post_uncheck_task
public function post_uncheck_task()
{
$data = Input::all();
Tasks::where(array('id' => $data['uncheck_task'], 'user_id' => Auth::id()))->update(array('status' => 0, 'updated_at' => new DateTime()));
$updated_task = Tasks::where(array('id' => $data['uncheck_task'], 'user_id' => Auth::id()))->first();
return array('task_name' => $updated_task->task_name);
}
示例5: getDescribedTaskArray
/**
* Funzione per ritornare il task array con delle informazioni in più
*/
private static function getDescribedTaskArray(DBResult $result, Project $active_project, User $logged_user, $items_limit = null)
{
$return_value = Tasks::getDescribedTaskArray($result, $active_project, $logged_user, $items_limit);
// a new array is created
$nuovo_ritorno = array();
if ($result instanceof DBResult) {
$id_assegnatari = array();
foreach ($result as $row) {
if ($row['assignee_id'] && !in_array($row['assignee_id'], $id_assegnatari)) {
$id_assegnatari[] = $row['assignee_id'];
}
//if
}
$assegnatari_array = count($id_assegnatari) ? Users::findByIds($id_assegnatari)->toArrayIndexedBy('getId') : array();
// Referenza &, non c'è copia.
// Per ognuno aggiungo l'assignee e la data di aggiornamento
foreach ($return_value as $chiave => &$task) {
foreach ($result as $row) {
//copio i vecchi valori
foreach ($task as $k => $v) {
$nuovo_ritorno[$chiave][$k] = $v;
}
//scorro tutto l'array dei risultati per ottenere la riga con il risultato corretto
if ($row['id'] == $task['id']) {
$nuovo_ritorno[$chiave]['assignee_id'] = $row['assignee_id'] ? $assegnatari_array[$row['assignee_id']] : null;
$nuovo_ritorno[$chiave]['updated_on'] = $row['updated_on'] ? datetimeval($row['updated_on']) : $row['created_on'];
}
}
}
}
// if
return $nuovo_ritorno;
}
示例6: task_Management
public function task_Management()
{
$data['task'] = Tasks::getThemAll();
$data['vaccine'] = Vaccines::getThemAll();
$data['content_view'] = "add_task_view";
$data['title'] = "New task";
$this->base_params($data);
}
示例7: run
public function run()
{
Model::unguard();
$times = 5;
for ($i = 0; $i < $times; $i++) {
Tasks::create(array('name' => Str::random(), 'active' => rand(0, 1)));
}
}
示例8: rememberWork
public function rememberWork()
{
$table = new Tasks();
$select = $table->select()->where('Server = ?', $this->session->id)->order('Created DESC')->limit(2);
$rows = $table->fetchAll($select);
$count = count($rows);
if ($count > 0) {
$this->view->message .= '<div class = "notice">';
$i = 0;
foreach ($rows as $row) {
$date = new Zend_Date($row->Created);
$this->view->message .= '<strong><u>Liste des tâches du ' . $date . '</u></strong><br />' . nl2br($row->Message);
if (++$i < $count) {
$this->view->message .= '<br /><br />';
}
}
$this->view->message .= '</div>';
} else {
//$this->view->message .= '<div class = "notice">Aucune tâche pour le moment</div>';
}
}
示例9: 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);
}
}
示例10: __before
/**
* Prepare controller
*/
function __before()
{
parent::__before();
if (!Tasks::canAccess($this->logged_user, $this->active_project)) {
$this->response->forbidden();
}
// if
// load project tabs
//$project_tabs = $this->active_project->getTabs($this->logged_user, AngieApplication::INTERFACE_DEFAULT);
$this->wireframe->tabs->setCurrentTab('fred_pt');
$this->wireframe->breadcrumbs->add('frosso_tab_route', lang('FRed tab'), Router::assemble('frosso_tab_route', array('project_slug' => $this->active_project->getSlug())));
}
示例11: executeListing
public function executeListing(sfWebRequest $request)
{
if (!isset($this->reports_id)) {
$this->reports_id = false;
}
$q = Doctrine_Core::getTable('Tasks')->createQuery('t')->leftJoin('t.TasksPriority tp')->leftJoin('t.TasksStatus ts')->leftJoin('t.TasksLabels tl')->leftJoin('t.TasksTypes tt')->leftJoin('t.TasksGroups tg')->leftJoin('t.ProjectsPhases pp')->leftJoin('t.Versions v')->leftJoin('t.Projects p')->leftJoin('t.Users');
if ($request->hasParameter('projects_id')) {
$q->addWhere('projects_id=?', $request->getParameter('projects_id'));
if (Users::hasAccess('view_own', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
} else {
if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
if (Users::hasAccess('view_own', 'tasks', $this->getUser())) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
}
if ($this->reports_id > 0) {
$q = UserReports::addFiltersToQuery($q, $this->reports_id, $this->getUser()->getAttribute('id'));
} elseif ($request->hasParameter('search')) {
$q = app::addSearchQuery($q, $request->getParameter('search'), 'TasksComments', 't', $request->getParameter('search_by_extrafields'));
$q = app::addListingOrder($q, 'tasks', $this->getUser());
} else {
$q = Tasks::addFiltersToQuery($q, $this->getUser()->getAttribute('tasks_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
$q = app::addListingOrder($q, 'tasks', $this->getUser(), (int) $request->getParameter('projects_id'));
}
$this->pager = false;
if (sfConfig::get('app_rows_limit') > 0) {
$this->pager = new sfDoctrinePager('Tasks', sfConfig::get('app_rows_limit'));
$this->pager->setQuery($q);
$this->pager->setPage($request->getParameter('page', 1));
$this->pager->init();
}
$this->tasks_list = $q->fetchArray();
if (isset($this->is_dashboard)) {
$this->url_params = 'redirect_to=dashboard';
$this->display_insert_button = true;
} elseif ($this->reports_id > 0) {
$this->url_params = 'redirect_to=userReports' . $this->reports_id;
$this->display_insert_button = true;
} else {
$this->url_params = 'redirect_to=tasksList';
if ($request->hasParameter('projects_id')) {
$this->url_params = 'projects_id=' . $request->getParameter('projects_id');
}
$this->display_insert_button = true;
}
$this->tlId = rand(1111111, 9999999);
$this->users_schema = Users::getSchema();
}
示例12: executeIndex
public function executeIndex(sfWebRequest $request)
{
$this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id')));
$this->forward404Unless($this->tasks = Doctrine_Core::getTable('Tasks')->createQuery()->addWhere('id=?', $request->getParameter('tasks_id'))->addWhere('projects_id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object tasks does not exist (%s).', $request->getParameter('id')));
$this->checkProjectsAccess($this->projects);
$this->checkTasksAccess('view', $this->tasks, $this->projects);
if (!$this->getUser()->hasAttribute('tasks_filter' . $request->getParameter('projects_id'))) {
$this->getUser()->setAttribute('tasks_filter' . $request->getParameter('projects_id'), Tasks::getDefaultFilter($request, $this->getUser()));
}
$this->tasks_comments = Doctrine_Core::getTable('TasksComments')->createQuery('tc')->leftJoin('tc.Users u')->addWhere('tc.tasks_id=?', $request->getParameter('tasks_id'))->orderBy('tc.created_at desc')->fetchArray();
$this->more_actions = $this->getMoreActions($request);
app::setPageTitle(t::__('Task') . ' | ' . ($this->tasks->getTasksLabelId() > 0 ? $this->tasks->getTasksLabels()->getName() . ': ' : '') . $this->tasks->getName(), $this->getResponse());
}
示例13: present
public function present()
{
$html = '<form class="tasksForm">';
$tasks = new Tasks($this->site);
$days = new Days($this->site);
$userId = $this->session[User::SESSION_NAME]->getId();
for ($i = 1; $i <= 7; $i++) {
$day = $days->getDayName($i);
$html .= '<div class="day"><a href=""><img src="images/plus.png" alt="Add button"></a>
<h2>' . $day . '</h2><p class="message"> </p>';
$taskList = $tasks->getTasksByDay($userId, $i);
if ($taskList !== null) {
$html .= '<div class="day-tasks"><ul class="day-list">';
foreach ($taskList as $taskItem) {
$html .= '<li><a href="">' . $taskItem['title'] . '</a><input type="hidden" name="taskId" value="' . $taskItem['id'] . '"/><input type="hidden" name="taskPriority" value="' . $taskItem['priority'] . '"/></li>';
}
$html .= '</ul></div>';
}
$html .= '</div>';
}
$html .= '<div class="clear"></div></form>';
return $html;
}
示例14: frosso_handle_on_milestone_sections
/**
* @param Project $project
* @param Milestone $milestone
* @param User $user
* @param NamedList $sections
* @param string $interface
*/
function frosso_handle_on_milestone_sections(&$project, &$milestone, &$user, &$sections, $interface)
{
//uncomment these lines to add a new tab, instead
if (Tasks::canAccess($user, $project)) {
Router::assemble('milestone_tasks', array('project_slug' => $project->getSlug(), 'milestone_id' => $milestone->getId()));
// $section = array(
// 'text' => lang('FRed'),
// 'url' => Router::assemble('tasks_frosso', array('project_slug' => $project->getSlug(), 'milestone_id' => $milestone->getId())),
// 'options' => array(),
// );
// $sections->add('frosso', $section);
}
// if
}
示例15: reindex_concept
public static function reindex_concept($args)
{
$taxon_concept_id = $args['taxon_concept_id'];
if (!$taxon_concept_id || !is_numeric($taxon_concept_id)) {
throw new \Exception("The TaxonConceptID was missing or was not a number");
return;
}
Tasks::update_taxon_concept_names(array($taxon_concept_id));
$he = new FlattenHierarchies();
$he->flatten_hierarchies_from_concept_id($taxon_concept_id);
TaxonConcept::reindex_descendants_objects($taxon_concept_id);
TaxonConcept::reindex_for_search($taxon_concept_id);
TaxonConcept::unlock_classifications_by_id($taxon_concept_id);
}