Beispiel #1
0
function print_task($tasks)
{
    $id = 1;
    foreach ($tasks as $task) {
        $childcount = Task::model()->count(array('condition' => 'parent_id=' . $task->id . ' AND deleted=0'));
        $assignment = TaskAssignment::model()->find(array('condition' => 'task_id=' . $task->id . ' AND deleted=0'));
        if ($childcount > 0) {
            $childtasks = Task::model()->findAll(array('condition' => 'parent_id=' . $task->id . ' AND deleted=0'));
            echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '", "' . $task->title . '", "' . date('m/d/Y', strtotime($task->start_date)) . '", "' . date('m/d/Y', strtotime($task->due_date)) . '", "659af7", "#", 0, "' . (isset($assignment) ? $assignment->member->username : '') . '", 0, 1, ' . ($task->has_parent ? $task->parent_id : 0) . ', 0));';
            print_task($childtasks);
        } else {
            echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '", "' . $task->title . '", "' . date('m/d/Y', strtotime($task->start_date)) . '", "' . date('m/d/Y', strtotime($task->due_date)) . '", "659af7", "#", 0, "' . (isset($assignment) ? $assignment->member->username : '') . '", 0, 0, ' . ($task->has_parent ? $task->parent_id : 0) . ', 0));';
            // set criteria for tasklog
            $criteria = new CDbCriteria();
            $criteria->with = array('taskAssignment.task');
            $criteria->order = 'date ASC';
            $criteria->condition = 'type="Project" AND task.id=' . $task->id . ' AND t.deleted=0 and task.deleted=0';
            $criteria2 = new CDbCriteria();
            $criteria2->with = array('taskAssignment.task');
            $criteria2->condition = 'type="Non-project" AND t.member_id=' . $assignment->member_id . ' AND t.deleted=0 AND t.date BETWEEN "' . $task->start_date . '" AND "' . $task->due_date . '"';
            $criteria3 = new CDbCriteria();
            $criteria3->with = array('taskAssignment.task');
            $criteria3->condition = 'type="Project" AND t.member_id=' . $assignment->member_id . ' AND t.deleted=0 AND t.date BETWEEN "' . $task->start_date . '" AND "' . $task->due_date . '"';
            // Merge criteria
            $criteria->mergeWith($criteria2, 'OR');
            $criteria->mergeWith($criteria3, 'OR');
            // Get tasklog based on criteria
            $tasklog = TaskLog::model()->findAll($criteria);
            if ($tasklog) {
                echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '.1", "' . $task->title . ' - REAL", "", "", "fe7e7e", "#", 0, "-", 0, 1, ' . ($task->has_parent ? $task->parent_id : 0) . ', 0));';
                foreach ($tasklog as $item) {
                    if ($item->type == "Non-project") {
                        echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '.' . $item->id . '", "' . $item->date . ' - ' . $item->task_title . ' (Non-project)", "' . date('m/d/Y', strtotime($item->date)) . '", "' . date('m/d/Y', strtotime($item->date)) . '", "737070", "#", 0, "' . $item->member->username . '", 0, 0, "' . $task->id . '.1", "' . $task->title . '-REAL", 0));';
                    } else {
                        if ($item->type == "Project" && $item->taskAssignment->task->id != $task->id) {
                            echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '.' . $item->id . '", "' . $item->date . ' - ' . $item->taskAssignment->task->title . ' (Different project)", "' . date('m/d/Y', strtotime($item->date)) . '", "' . date('m/d/Y', strtotime($item->date)) . '", "737070", "#", 0, "' . $item->member->username . '", 0, 0, "' . $task->id . '.1", "' . $task->title . '-REAL", 0));';
                        } else {
                            echo 'g.AddTaskItem(new JSGantt.TaskItem("' . $task->id . '.' . $item->id . '", "' . $item->date . '", "' . date('m/d/Y', strtotime($item->date)) . '", "' . date('m/d/Y', strtotime($item->date)) . '", "fe7e7e", "#", 0, "' . $item->member->username . '", 0, 0, "' . $task->id . '.1", "' . $task->title . '-REAL", 0));';
                        }
                    }
                }
            }
        }
    }
}
Beispiel #2
0
<?php

require_once '../commons/base.inc.php';
try {
    // Get the Host
    $Host = $FOGCore->getHostItem(false, false, true);
    if ($Host && $Host->isValid()) {
        // Task for Host
        $Task = $Host->get('task');
        if ($Task && $Task->isValid()) {
            if (!in_array($Task->get('typeID'), array(12, 13))) {
                $Task->set('stateID', 4);
            }
            if ($Task->save()) {
                // Task Logging.
                $TaskLog = new TaskLog($Task);
                $TaskLog->set('taskID', $Task->get('id'))->set('taskStateID', $Task->get('stateID'))->set('createdTime', $Task->get('createdTime'))->set('createdBy', $Task->get('createdBy'))->save();
            }
        }
    }
    print '##';
} catch (Exception $e) {
    print $e->getMessage();
}
        </tr>
    </thead>
    <tbody>
    <?php 
if (empty($logs)) {
    ?>
    <tr> 
        <td colspan=5><span class="ml10">无备注</span</td>
    </tr> 
    <?php 
} else {
    ?>
    <?php 
    $total = count($logs);
    foreach ($logs as $num => $log) {
        $log = TaskLog::load($log);
        ?>
    <tr> 
        <td nowrap><?php 
        echo $num + 1;
        ?>
</td>
        <td nowrap><?php 
        echo $log->dto->ctime->toString();
        ?>
</td>
        <td nowrap><?php 
        echo $log->ownerName;
        ?>
</td>
        <td><?php 
        // If client count is equal, place session task in-progress as it will likely start soon.
        if ($MSAs == $MultiSess->get('clients') || $MultiSess->get('sessclients') > 0 && $MultiSess->get('clients') > 0) {
            $MultiSess->set('stateID', 3);
        } else {
            $MultiSess->set('stateID', 1);
        }
    }
    // Save the info.
    if ($Task->save() && ($Task->get('typeID') == 8 ? $MultiSess->save() : true)) {
        if ($MultiSess && $MultiSess->isValid()) {
            $Host->set('imageID', $MultiSess->get('image'));
        }
        // Log it
        $ImagingLogs = $FOGCore->getClass('ImagingLogManager')->find(array('hostID' => $Host->get('id'), 'type' => $_REQUEST['type'], 'complete' => '0000-00-00 00:00:00'));
        foreach ($ImagingLogs as $ImagingLog) {
            $id[] = $ImagingLog->get('id');
        }
        if (!$id) {
            $il = new ImagingLog(array('hostID' => $Host->get('id'), 'start' => $FOGCore->nice_date()->format('Y-m-d H:i:s'), 'image' => $Task->getImage()->get('name'), 'type' => $_REQUEST['type']));
        } else {
            $il = new ImagingLog(max($id));
            $il->set('start', $FOGCore->nice_set()->format('Y-m-d H:i:s'));
        }
        $il->save();
        $TaskLog = new TaskLog(array('taskID' => $Task->get('id'), 'taskStateID' => $Task->get('stateID'), 'createdTime' => $Task->get('createdTime'), 'createdBy' => $Task->get('createdBy')));
        $TaskLog->save();
        print '##@GO';
    }
} catch (Exception $e) {
    print $e->getMessage();
}
Beispiel #5
0
<?php

/* @var $this SiteController */
$this->widget('booster.widgets.TbBreadcrumbs', array('links' => array('Dashboard')));
// Retrieve user project info
$my_upcomingprojects = Project::model()->count(array('condition' => 'status="Upcoming" AND deleted=0 AND creator_id=' . Yii::app()->user->id));
$my_activeprojects = Project::model()->count(array('condition' => 'status="Active" AND deleted=0 AND creator_id=' . Yii::app()->user->id));
$my_completedprojects = Project::model()->count(array('condition' => 'status="Complete" AND deleted=0 AND creator_id=' . Yii::app()->user->id));
$my_expiredprojects = Project::model()->count(array('condition' => 'status="Expired" AND deleted=0 AND creator_id=' . Yii::app()->user->id));
// Retrieve all projects info
$all_upcomingprojects = Project::model()->count(array('condition' => 'status="Upcoming" AND deleted=0'));
$all_activeprojects = Project::model()->count(array('condition' => 'status="Active" AND deleted=0'));
$all_completedprojects = Project::model()->count(array('condition' => 'status="Complete" AND deleted=0'));
$all_expiredprojects = Project::model()->count(array('condition' => 'status="Expired" AND deleted=0'));
// Retrieve last activity
$recentlogs = TaskLog::model()->findAll(array('order' => 'timestamp DESC', 'limit' => 3, 'condition' => 'deleted=0 AND type="Project"'));
$recentprojects = Project::model()->findAll(array('order' => 'timestamp DESC', 'limit' => 3, 'condition' => 'deleted=0'));
$recentassignments = TaskAssignment::model()->findAll(array('order' => 'timestamp DESC', 'limit' => 3, 'condition' => 'deleted=0'));
//$recentcompletions = SubtaskCompletion::model()->findAll(array('order'=>'timestamp DESC', 'limit'=>3, 'condition'=>'deleted=0'));
?>

<!-- HEADER -->
<h2 class="page-header">Dashboard</h2>

<!-- PROJECTS PANEL -->
<div class="span-6">
    <!-- MY PROJECTS -->
    <div class="panel panel-primary">
        <!-- heading -->
        <div class="panel-heading">
            <span class="glyphicon glyphicon-folder-open"></span>
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return TaskLog the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = TaskLog::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }