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


PHP ProjectTasks::count方法代码示例

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


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

示例1: multi_task_action

 function multi_task_action()
 {
     ajx_current("empty");
     $ids = explode(',', array_var($_POST, 'ids'));
     $action = array_var($_POST, 'action');
     $options = array_var($_POST, 'options');
     if (!is_array($ids) || trim(array_var($_POST, 'ids')) == '' || count($ids) <= 0) {
         flash_error(lang('no items selected'));
         return;
     }
     $count_tasks = ProjectTasks::count('object_id in (' . implode(',', $ids) . ')');
     $tasksToReturn = array();
     $showSuccessMessage = true;
     try {
         DB::beginWork();
         foreach ($ids as $id) {
             $task = Objects::findObject($id);
             switch ($action) {
                 case 'complete':
                     if ($task->canEdit(logged_user())) {
                         $task->completeTask($options);
                         // if task is repetitive, generate a complete instance of this task and modify repeat values
                         if ($task->isRepetitive()) {
                             $complete_last_task = false;
                             // calculate next repetition date
                             $opt_rep_day = array('saturday' => false, 'sunday' => false);
                             $new_dates = $this->getNextRepetitionDates($task, $opt_rep_day, $new_st_date, $new_due_date);
                             // if this is the last task of the repetetition, complete it, do not generate a new instance
                             if ($task->getRepeatNum() > 0) {
                                 $task->setRepeatNum($task->getRepeatNum() - 1);
                                 if ($task->getRepeatNum() == 0) {
                                     $complete_last_task = true;
                                 }
                             }
                             if (!$complete_last_task && $task->getRepeatEnd() instanceof DateTimeValue) {
                                 if ($task->getRepeatBy() == 'start_date' && array_var($new_dates, 'st') > $task->getRepeatEnd() || $task->getRepeatBy() == 'due_date' && array_var($new_dates, 'due') > $task->getRepeatEnd()) {
                                     $complete_last_task = true;
                                 }
                             }
                             if (!$complete_last_task) {
                                 // generate new pending task
                                 $new_task = $task->cloneTask(array_var($new_dates, 'st'), array_var($new_dates, 'due'));
                                 $reload_view = true;
                             }
                         }
                         $tasksToReturn[] = $task->getArrayInfo();
                     }
                     break;
                 case 'delete':
                     if ($task->canDelete(logged_user())) {
                         $tasksToReturn[] = array('id' => $task->getId());
                         $task->trash();
                         ApplicationLogs::createLog($task, ApplicationLogs::ACTION_TRASH);
                         if ($options == "news" || $options == "all") {
                             $tasksToReturn_related = $this->repetitive_tasks_related($task, "delete", $options);
                             foreach ($tasksToReturn_related as $tasksToReturn_rel) {
                                 $tasksToReturn[] = array('id' => $tasksToReturn_rel);
                             }
                         }
                     }
                     break;
                 case 'archive':
                     if ($task->canEdit(logged_user())) {
                         $tasksToReturn[] = $task->getArrayInfo();
                         $task->archive();
                         ApplicationLogs::createLog($task, ApplicationLogs::ACTION_ARCHIVE);
                         if ($options == "news" || $options == "all") {
                             $tasksToReturn_related = $this->repetitive_tasks_related($task, "archive", $options);
                             foreach ($tasksToReturn_related as $tasksToReturn_rel) {
                                 $tasksToReturn[] = array('id' => $tasksToReturn_rel);
                             }
                         }
                     }
                     break;
                 case 'start_work':
                     if ($task->canEdit(logged_user())) {
                         $task->addTimeslot(logged_user());
                         ApplicationLogs::createLog($task, ApplicationLogs::ACTION_EDIT, false, true);
                         $tasksToReturn[] = $task->getArrayInfo();
                         $showSuccessMessage = false;
                     }
                     break;
                 case 'close_work':
                     if ($task->canEdit(logged_user())) {
                         $task->closeTimeslots(logged_user(), array_var($_POST, 'options'));
                         ApplicationLogs::createLog($task, ApplicationLogs::ACTION_EDIT, false, true);
                         $tasksToReturn[] = $task->getArrayInfo();
                         $showSuccessMessage = false;
                     }
                     break;
                 case 'pause_work':
                     if ($task->canEdit(logged_user())) {
                         $task->pauseTimeslots(logged_user());
                         $tasksToReturn[] = $task->getArrayInfo();
                         $showSuccessMessage = false;
                     }
                     break;
                 case 'resume_work':
                     if ($task->canEdit(logged_user())) {
                         $task->resumeTimeslots(logged_user());
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:TaskController.class.php

示例2: countCompletedTasks

 /**
  * Return number of completed tasks
  *
  * @access public
  * @param void
  * @return integer
  */
 function countCompletedTasks()
 {
     if (is_null($this->count_completed_tasks)) {
         if (is_array($this->completed_tasks)) {
             $this->count_completed_tasks = count($this->completed_tasks);
         } else {
             $this->count_completed_tasks = ProjectTasks::count('`task_list_id` = ' . DB::escape($this->getId()) . ' AND `completed_on` > ' . DB::escape(EMPTY_DATETIME));
         }
         // if
     }
     // if
     return $this->count_completed_tasks;
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:20,代码来源:ProjectTaskList.class.php

示例3: lang

  <?php 
    echo lang('new account step start workspace info', '<span class="ico-workspace-add" style="padding: 5px 16px 0 0">&nbsp;</span>', logged_user()->getPersonalProject()->getName());
    ?>
<br/><br/>
<?php 
}
$step++;
?>
  

<b><?php 
echo lang('new account step actions', $step);
?>
</b>
	<?php 
$task_count = ProjectTasks::count('`created_by_id` = ' . logged_user()->getId());
$note_count = ProjectMessages::count('`created_by_id` = ' . logged_user()->getId());
//$contact = ProjectContacts::findOne(array('conditions'=>'created_by_id='.logged_user()->getId()));
if ($task_count > 0 || $note_count > 0) {
    echo '<img src="' . image_url('16x16/complete.png') . '" />';
}
?>
<br/>
<?php 
echo lang('new account step actions info');
?>
<br/>

<span class="ico-message" style="padding: 5px 16px 0 0">&nbsp;</span>
<a class='internalLink dashboard-link' href='<?php 
echo get_url('message', 'add');
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:widget_getting_started.php

示例4: multi_task_action

 function multi_task_action()
 {
     ajx_current("empty");
     $ids = explode(',', array_var($_POST, 'ids'));
     $action = array_var($_POST, 'action');
     $options = array_var($_POST, 'options');
     if (!is_array($ids) || trim(array_var($_POST, 'ids')) == '' || count($ids) <= 0) {
         flash_error(lang('no items selected'));
         return;
     }
     $count_tasks = ProjectTasks::count('object_id in (' . implode(',', $ids) . ')');
     $tasksToReturn = array();
     $subt_info = array();
     $showSuccessMessage = true;
     $application_logs = array();
     try {
         DB::beginWork();
         $all_tasks = array();
         foreach ($ids as $id) {
             $task = Objects::findObject($id);
             $task->setDontMakeCalculations(true);
             // all the calculations should be after all tasks are saved
             $all_tasks[] = $task;
             switch ($action) {
                 case 'complete':
                     if ($task->canEdit(logged_user())) {
                         $log_info = $task->completeTask($options);
                         $application_logs[] = array($task, ApplicationLogs::ACTION_CLOSE, false, false, true, substr($log_info, 0, -1));
                         // if task is repetitive, generate a complete instance of this task and modify repeat values
                         if ($task->isRepetitive()) {
                             $complete_last_task = false;
                             // calculate next repetition date
                             $opt_rep_day = array('saturday' => false, 'sunday' => false);
                             $new_dates = $this->getNextRepetitionDates($task, $opt_rep_day, $new_st_date, $new_due_date);
                             // if this is the last task of the repetetition, complete it, do not generate a new instance
                             if ($task->getRepeatNum() > 0) {
                                 $task->setRepeatNum($task->getRepeatNum() - 1);
                                 if ($task->getRepeatNum() == 0) {
                                     $complete_last_task = true;
                                 }
                             }
                             if (!$complete_last_task && $task->getRepeatEnd() instanceof DateTimeValue) {
                                 if ($task->getRepeatBy() == 'start_date' && array_var($new_dates, 'st') > $task->getRepeatEnd() || $task->getRepeatBy() == 'due_date' && array_var($new_dates, 'due') > $task->getRepeatEnd()) {
                                     $complete_last_task = true;
                                 }
                             }
                             if (!$complete_last_task) {
                                 // generate new pending task
                                 $new_task = $task->cloneTask(array_var($new_dates, 'st'), array_var($new_dates, 'due'));
                                 $reload_view = true;
                             }
                         }
                         foreach ($task->getAllSubTasks() as $sub) {
                             $tasksToReturn[] = $sub->getArrayInfo();
                         }
                         $tasksToReturn[] = $task->getArrayInfo();
                     }
                     break;
                 case 'delete':
                     if ($task->canDelete(logged_user())) {
                         $tasksToReturn[] = $task->getArrayInfo();
                         $task->trash();
                         $application_logs[] = array($task, ApplicationLogs::ACTION_TRASH);
                         if ($options == "news" || $options == "all") {
                             $tasksToReturn_related = $this->repetitive_tasks_related($task, "delete", $options);
                             foreach ($tasksToReturn_related as $tasksToReturn_rel) {
                                 $tasksToReturn[] = array('id' => $tasksToReturn_rel);
                             }
                         }
                     }
                     break;
                 case 'archive':
                     if ($task->canEdit(logged_user())) {
                         $tasksToReturn[] = $task->getArrayInfo();
                         $task->archive();
                         $application_logs[] = array($task, ApplicationLogs::ACTION_ARCHIVE);
                         if ($options == "news" || $options == "all") {
                             $tasksToReturn_related = $this->repetitive_tasks_related($task, "archive", $options);
                             foreach ($tasksToReturn_related as $tasksToReturn_rel) {
                                 $tasksToReturn[] = array('id' => $tasksToReturn_rel);
                             }
                         }
                     }
                     break;
                 case 'start_work':
                     if ($task->canAddTimeslot(logged_user())) {
                         $timeslot = $task->addTimeslot(logged_user());
                         $application_logs[] = array($timeslot, ApplicationLogs::ACTION_OPEN, false, true);
                         $tasksToReturn[] = $task->getArrayInfo();
                         $showSuccessMessage = false;
                     }
                     break;
                 case 'close_work':
                     if ($task->canAddTimeslot(logged_user())) {
                         $timeslot = $task->closeTimeslots(logged_user(), array_var($_POST, 'options'));
                         $application_logs[] = array($timeslot, ApplicationLogs::ACTION_CLOSE, false, true);
                         $showSuccessMessage = false;
                         $task->calculatePercentComplete();
                         $tasksToReturn[] = $task->getArrayInfo();
                     }
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:TaskController.class.php

示例5: getArrayInfo

 function getArrayInfo()
 {
     $tnum = ProjectTasks::count('milestone_id = ' . $this->getId() . " AND `trashed_on` = " . DB::escape(EMPTY_DATETIME));
     $tc = ProjectTasks::count('milestone_id = ' . $this->getId() . ' and completed_on > ' . DB::escape(EMPTY_DATETIME) . ' AND `trashed_on` = ' . DB::escape(EMPTY_DATETIME));
     $result = array('id' => $this->getId(), 't' => $this->getTitle(), 'wsid' => $this->getWorkspacesIdsCSV(), 'tnum' => $tnum, 'tc' => $tc, 'dd' => $this->getDueDate()->getTimestamp());
     $tags = $this->getTagNames();
     if ($tags) {
         $result['tags'] = $tags;
     }
     if ($this->getCompletedById() > 0) {
         $result['compId'] = $this->getCompletedById();
         $result['compOn'] = $this->getCompletedOn()->getTimestamp();
     }
     $result['is_urgent'] = $this->getIsUrgent();
     return $result;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:16,代码来源:ProjectMilestone.class.php


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