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));'; } } } } } } }
while ($task->has_parent) { $task = Task::model()->findByPk($task->parent_id); $links = array_merge(array($task->title => array('task/view', 'id' => $task->id)), $links); } $links = array_merge(array($model->project->name => array('project/view', 'id' => $model->project_id)), $links); $links = array_merge(array('Projects' => array('project/index')), $links); // Displaying breadcrumbs $this->widget('booster.widgets.TbBreadcrumbs', array('links' => $links)); $this->menu = array(array('label' => 'See my projects', 'url' => array('project/myProjects')), array('label' => 'See all projects', 'url' => array('project/index')), array('label' => 'Add task', 'url' => array('task/create', 'id' => $model->project_id)), array('label' => 'Update task', 'url' => array('task/update', 'id' => $model->id))); ?> <h2 class="page-header">Task Detail : <?php echo $model->title; ?> </h2> <?php $this->widget('booster.widgets.TbDetailView', array('id' => 'task-detail', 'data' => $model, 'attributes' => array('project.name', array('label' => 'Parent Task', 'value' => $model->has_parent == 0 ? '-' : $model->parent->title), array('label' => 'Creator', 'value' => $model->creator->username), array('label' => 'Assigned to', 'value' => TaskAssignment::model()->find(array('condition' => 'task_id=' . $model->id . ' AND deleted=0')) ? TaskAssignment::model()->find(array('condition' => 'task_id=' . $model->id . ' AND deleted=0'))->member->username : '******'), array('label' => 'Start date', 'value' => date('d-m-Y', strtotime($model->start_date))), array('label' => 'Due date', 'value' => date('d-m-Y', strtotime($model->due_date))), array('label' => 'Status', 'value' => $model->status)))); ?> <!-- Display current status --> <!--<h4> <b>Current Status :</b> <?php /*$model->status=="New" ? $this->widget('booster.widgets.TbLabel', array('context' => 'default','label' => 'NEW')) : ($model->status=="On progress" ? $this->widget('booster.widgets.TbLabel', array('context' => 'primary','label' => 'ON PROGRESS')) : $this->widget('booster.widgets.TbLabel', array('context' => 'success','label' => 'COMPLETE')))*/ ?> </h4>--> <div class="span-24"><hr> <!-- List of subtask(s) --> <i class="glyphicon glyphicon-th-list"></i><b> List of Subtask(s) : <div class="right"><?php
} } } // verifico se a pessoa já existe no array public function verify($assoc, $col) { foreach ($assoc as $a) { if ($a == $col) { return false; } } return true; } public function getBestSolution() { return $this->minCost; } public function getBestState() { return $this->minAssign; } } echo "<br><br>"; $costs = $_POST['works']; $obj = new TaskAssignment(); $obj->start($costs); echo "A melhor solução para o problema é:<br>"; foreach ($obj->getBestState() as $key => $item) { echo "Funcionário " . $key . " fará a <b>Tarefa " . $item . "</b><br>"; } echo "O custo total será de: <b>" . $obj->getBestSolution() . "</b>";
/* @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> <span><strong> My projects</strong></span> </div>
public function actionMyTask() { $mytask = new TaskAssignment('my'); $mytask->unsetAttributes(); // clear any default values if (isset($_GET['TaskAssignment'])) { $mytask->attributes = $_GET['TaskAssignment']; } $this->render('mytask', array('mytask' => $mytask)); /*$criteria = new CDbCriteria; $criteria->join = 'JOIN t_task ON t.task_id = t_task.id'; $criteria->condition = 'member_id='.Yii::app()->user->id.' AND t_task.deleted=0 AND t.deleted=0 AND status != "Complete"'; $mytask = new CActiveDataProvider('TaskAssignment', array('criteria'=>$criteria)); $this->render('mytask',array( 'mytask'=>$mytask, ));*/ }
public function actionCalendarEventsStaff() { $items = array(); $model = TaskAssignment::model()->findAll(array('condition' => 'member_id=' . Yii::app()->user->id . ' AND deleted=0')); foreach ($model as $value) { //echo $value->task->title; $items[] = array('title' => $value->task->title, 'start' => $value->task->start_date, 'end' => date('Y-m-d', strtotime('+1 day', strtotime($value->task->due_date))), 'color' => $value->task->status == "Not complete" ? '#fe6e6e' : 'default', 'idevent' => $value->task->id); } echo CJSON::encode($items); Yii::app()->end(); }
<?php /* @var $this TaskLogController */ /* @var $model TaskLog */ /* @var $form CActiveForm */ $task_list = CHtml::listData(TaskAssignment::model()->with('task')->findAll(array('condition' => 'task.deleted=0 AND task.status != "Complete" AND t.deleted=0')), 'id', 'task.concatened'); ?> <div class="form"> <script> $(document).ready(function(){ if(document.getElementById('type').value === "Non-project") { $("#task_assignment_id").val(null); $("#task_assignment_id").prop('disabled', true); $("#task_title").prop('disabled', false); } else if(document.getElementById('type').value === "Project") { $("#task_title").val(null); $("#task_assignment_id").prop('disabled', false); $("#task_title").prop('disabled', true); } $("#type").change(function(){ if(this.value === "Non-project") { $("#task_assignment_id").val(null); $("#task_assignment_id").prop('disabled', true); $("#task_title").prop('disabled', false); } else if(this.value === "Project") { $("#task_title").val(null); $("#task_assignment_id").prop('disabled', false);