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


PHP Task::complete方法代码示例

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


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

示例1: Task

 function action_request_completed()
 {
     $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
     mysql_select_db(DB_NAME);
     $query = "update healingcrystals_assignments_action_request set is_action_request='-1', last_modified=now() where is_action_request='1' and user_id='" . $this->logged_user->getId() . "' and comment_id='" . $this->active_comment->getId() . "'";
     mysql_query($query);
     $query = "select object_id from actionrequests_to_tasklist where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $this->logged_user->getId() . "' and type='Task'";
     $result = mysql_query($query);
     if (mysql_num_rows($result)) {
         $info = mysql_fetch_assoc($result);
         $task = new Task($info['object_id']);
         $task->complete($this->logged_user);
         $task->save();
     }
     mysql_close($link);
     //$this->redirectToUrl(assemble_url('goto_home_tab'));
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:17,代码来源:CommentsController.class.php

示例2: __construct

<?php

class Task
{
    //public means outside of this class anyone can access this instance
    public $description;
    public $completed = false;
    //this function is called everytime a new class is created
    public function __construct($description)
    {
        //$this refers to this object
        //more specifically this instance of this class
        $this->description = $description;
    }
    public function complete()
    {
        $this->completed = true;
    }
}
$task = new Task('learn OOP');
$task->complete();
$task2 = new Task('groceries');
var_dump($task->completed);
var_dump($task2->description);
开发者ID:bartolini69,项目名称:Laracast-Tutorials,代码行数:24,代码来源:Tasks.php

示例3: complete

 public function complete()
 {
     if (isset($this->_data['id'])) {
         $flash = Flash::Instance();
         $flash->addMessage('Task marked as completed');
         $task = new Task();
         $task->load($this->_data['id']);
         $task->complete();
         sendBack();
     }
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:11,代码来源:TasksController.php

示例4: complete

 /**
  * Complete specific object
  *
  * @param void
  * @return null
  */
 function complete()
 {
     if ($this->active_task->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_task->canChangeCompleteStatus($this->logged_user) && $this->active_task->getProjectId() != TASK_LIST_PROJECT_ID) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     if ($this->request->isSubmitted() || isset($_GET['auto'])) {
         //BOF:mod 20110617
         $responsible_assignee = $this->active_task->getResponsibleAssignee();
         $created_by_id = $this->active_task->getCreatedById();
         $project_leader = $this->active_project->getLeaderId();
         $parent_type = $this->active_task->getParentType();
         //BOF:mod 20120824
         /*
         //EOF:mod 20120824
         $ticket_owner_exists = false;
         if ($parent_type=='Ticket'){
         	$temp_ticket = new Ticket($this->active_task->getParentId());
         	$ticket_owner = $temp_ticket->getResponsibleAssignee();
         	if (!empty($ticket_owner)){
         		$ticket_owner_exists = true;
         	}
         }
         //BOF:mod 20120824
         */
         $owner_exists = false;
         $parent = new $parent_type($this->active_task->getParentId());
         $owner = $parent->getResponsibleAssignee();
         if (!empty($owner)) {
             $owner_exists = true;
         }
         //BOF:mod 20121031
         $user_is_subscriber = false;
         $subscribers = array();
         if ($parent->can_have_subscribers) {
             if ($parent->hasSubscribers()) {
                 $subscribers = $parent->getSubscribers();
                 foreach ($subscribers as $subscriber) {
                     if ($subscriber->getId() == $this->logged_user->getId()) {
                         $user_is_subscriber = true;
                         break;
                     }
                 }
             }
         }
         //EOF:mod 20121031
         $page_user_id = '';
         if ($parent_type == 'Page' && stripos($parent->getName(), 'task list') !== false) {
             $temp = explode('-', $parent->getName());
             if (count($temp)) {
                 $name = trim($temp[0]);
                 $name_parts = explode(' ', $name);
                 if (count($name_parts)) {
                     list($first_name, $last_name) = $name_parts;
                     $first_name = trim($first_name);
                     $last_name = trim($last_name);
                     $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
                     mysql_select_db(DB_NAME);
                     $query = "select id from healingcrystals_users where first_name='" . mysql_real_escape_string($first_name) . "'" . (!empty($last_name) ? " and last_name='" . mysql_real_escape_string($last_name) . "'" : "");
                     $result = mysql_query($query, $link);
                     if (mysql_num_rows($result)) {
                         $info = mysql_fetch_assoc($result);
                         $page_user_id = $info['id'];
                     }
                     mysql_close($link);
                 }
             }
         }
         //EOF:mod 20120824
         //BOF:mod 20120917 (reversed by shawn)
         /**/
         //EOF:mod 20120917
         if (!is_null($responsible_assignee) && $responsible_assignee->getId() == $this->logged_user->getId() || $created_by_id == $this->logged_user->getId() || $project_leader == $this->logged_user->getId() || $this->logged_user->isAdministrator() || $user_is_subscriber || !empty($page_user_id) && $page_user_id == $this->logged_user->getId() || $owner_exists && $owner == $this->logged_user->getId()) {
             //BOF:mod 20120824
             $warning = '';
         } else {
             $temp = new User($created_by_id);
             $warning = 'Message: Task "' . $this->active_task->getName() . '" cannot be closed at this time. Please send message to ' . $temp->getName() . ' to close this task.';
             unset($temp);
         }
         if (!empty($warning)) {
             $this->smarty->assign(array('warning' => $warning));
             print tpl_fetch(get_template_path('_task_completed_row', $this->controller_name, RESOURCES_MODULE));
             die;
         }
         //BOF:mod 20120917 (reversed by shawn)
         /**/
         //EOF:mod 20120917
         //EOF:mod 20110617
         db_begin_work();
//.........这里部分代码省略.........
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:TasksController.class.php

示例5: system_handle_on_daily

/**
 * Do daily taks
 *
 * @param void
 * @return null
 */
function system_handle_on_daily()
{
    ProjectObjectViews::cleanUp();
    $priorities_images = array(PRIORITY_URGENT => 'assets/images/icons/priority/urgent.png', PRIORITY_HIGHEST => 'assets/images/icons/priority/highest.gif', PRIORITY_HIGH => 'assets/images/icons/priority/high.gif', PRIORITY_NORMAL => 'assets/images/icons/priority/normal.gif', PRIORITY_LOW => 'assets/images/icons/priority/low.gif', PRIORITY_LOWEST => 'assets/images/icons/priority/lowest.gif', PRIORITY_HOLD => 'assets/images/icons/priority/hold.png', '-99' => 'assets/images/icons/priority/unknown.png');
    $pages = array();
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
    mysql_select_db(DB_NAME);
    $sql = "select id, name from healingcrystals_project_objects where project_id='" . TASK_LIST_PROJECT_ID . "' and type='Page'";
    $result = mysql_query($sql, $link);
    while ($entry = mysql_fetch_assoc($result)) {
        list($name, ) = explode('-', $entry['name']);
        $name = trim($name);
        $pages[$name] = $entry['id'];
    }
    $current_time = time();
    $users = Users::findAll();
    foreach ($users as $user) {
        $flag = 1;
        $message = '';
        $name = $user->getName();
        if (array_key_exists($name, $pages)) {
            $page = new Page($pages[$name]);
            if ($page) {
                $sql = "select id from healingcrystals_project_objects where parent_id='" . $pages[$name] . "' and parent_type='Page' and type='Task' and completed_on is null and priority is null and created_on>='" . date('Y-m-d H:i:s', $current_time - 1 * 24 * 60 * 60) . "' order by created_on";
                $result = mysql_query($sql, $link);
                if (mysql_num_rows($result)) {
                    $show_task_list = true;
                } else {
                    $show_task_list = false;
                }
                if (date('N') == '1' || $show_task_list) {
                    $message .= '<style>
		.odd {background-color:#ffffff;}
		.even{background-color:#eeeeee;}
	</style>
	<table>
		<tr>
			<td colspan="3">Task List: ' . $name . '</td>
		</tr>
		<tr>
			<td align="center">Priority</td>
			<td>Task</td>
			<td>&nbsp;</td>
		</tr>';
                    $tasks = Tasks::findOpenByObject($page);
                    foreach ($tasks as $task) {
                        $message .= '
		<tr class="' . ($flag % 2 === 1 ? 'odd' : 'even') . '">
			<td valign="top" align="center"><img  src="http://projects.ffbh.org/public/' . $priorities_images[$task->getPriority()] . '"/></td>
			<td valign="top">' . $task->getName() . '</td>
			<td valign="top"><a href="' . $task->getViewUrl() . '">View</a></td>
		</tr>';
                        $flag++;
                    }
                    $message .= '
	</table>';
                    $subject = 'projects: healingcrystals.com Task list';
                    $headers = 'MIME-Version: 1.0' . "\r\n";
                    $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
                    $headers .= 'From: FFBH Reminder <auto@ffbh.org>' . "\r\n";
                    mail($user->getEmail(), $subject, $message, $headers);
                }
            }
        }
    }
    $sql = "select po.id, cast(if( pom.recurring_period_type='D', DATE_ADD(po.due_on, interval pom.recurring_period day), if(pom.recurring_period_type='W', DATE_ADD(po.due_on, interval pom.recurring_period week), if(pom.recurring_period_type='M', DATE_ADD(po.due_on, interval pom.recurring_period month), null ) ) ) as Date) as next_due_date, cast(DATE_ADD(now(), interval 0 day) as Date) as cur_date, cast(if(isnull(pom.email_reminder_unit), null, if( pom.email_reminder_unit='D', DATE_ADD(po.due_on, interval pom.email_reminder_period day), if(pom.email_reminder_unit='W', DATE_ADD(po.due_on, interval pom.email_reminder_period week), if(pom.email_reminder_unit='M', DATE_ADD(po.due_on, interval pom.email_reminder_period month), null ) ) )\t) as Date) as reminder_date from healingcrystals_project_objects po inner join  healingcrystals_project_object_misc pom on po.id=pom.object_id where po.type='Task' and po.due_on is not null and po.due_on<=now() and po.completed_on is null and pom.recurring_period_condition='after_due_date' and if(pom.recurring_end_date is not null and pom.recurring_end_date!='0000-00-00', if(pom.recurring_end_date>=now(), 1, 0), 1)=1 having next_due_date=cur_date";
    $result = mysql_query($sql);
    while ($entry = mysql_fetch_assoc($result)) {
        $task = new Task($entry['id']);
        $action = $task->complete(new AnonymousUser('auto', 'auto@projects.ffbh.org'));
        if (!empty($entry['reminder_date']) && $entry['cur_date'] == $entry['reminder_date']) {
            $sql02 = "select id from " . TABLE_PREFIX . "project_objects where type='Task' and project_id='" . $task->getProjectId() . "' and milestone_id='" . $task->getMilestoneId() . "' and parent_id='" . $task->getParentId() . "' order by id desc limit 0, 1";
            $result02 = mysql_query($sql02);
            if (mysql_num_rows($result02)) {
                $info = mysql_fetch_assoc($result02);
                $recurring_task = new Task($info['id']);
                $parent = $recurring_task->getParent();
                $project = $recurring_task->getProject();
                $assignees = $recurring_task->getAssignees();
                $priorities = array(PRIORITY_HIGHEST => lang('Highest'), PRIORITY_HIGH => lang('High'), PRIORITY_NORMAL => lang('Normal'), PRIORITY_LOW => lang('Low'), PRIORITY_LOWEST => lang('Lowest'), PRIORITY_ONGOING => lang('Ongoing'), PRIORITY_HOLD => lang('Hold'));
                $due_date = $task->getDueOn();
                $due_date = date('m/d/Y', strtotime($due_date));
                $reminder_date = date('m/d/Y', strtotime($entry['reminder_date']));
                foreach ($assignees as $assignee) {
                    $assignees_string .= $assignee->getDisplayName() . ', ';
                }
                if (!empty($assignees_string)) {
                    $assignees_string = substr($assignees_string, 0, -2);
                } else {
                    $assignees_string = '--';
                }
                $reminders_sent = array();
                foreach ($assignees as $user) {
                    //if ($user->getEmail()=='anuj@focusindia.com'){
//.........这里部分代码省略.........
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:on_daily.php

示例6: testComplete

 function testComplete()
 {
     //Arrange
     $description = "Wash the dog";
     $id = 1;
     $due_date = "2015-04-01";
     $complete = 0;
     $test_task = new Task($description, $id, $due_date, $complete);
     $test_task->save();
     //Act
     $test_task->complete();
     //Assert
     $this->assertEquals(1, $test_task->getComplete());
 }
开发者ID:alexdbrown,项目名称:to_do_SQL_linked,代码行数:14,代码来源:TaskTest.php

示例7: taskComplete

 public function taskComplete()
 {
     $id = $_GET['id'];
     $task = new Task();
     $task->complete($id);
 }
开发者ID:peterjewicz,项目名称:client_tracker,代码行数:6,代码来源:taskController.php


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