<div class="portlet-content"> <div class="grid_8"> <h1 class="ptitleinfo tasks"> <?php echo $model->task_name; ?> </h1> </div> <div class="grid_4"> <h1 class="prtribbon"> <span class="priority pr<?php echo CHtml::encode($model->task_priority); ?> "> <?php echo Tasks::getNameOfTaskPriority($model->task_priority); ?> </span> </h1> </div> <div class="clear"> </div> <div class="button-group portlet-tab-nav"> <?php echo CHtml::link(Yii::t('tasks', 'ListTasks'), Yii::app()->controller->createUrl('index'), array('class' => 'button primary')); ?> <?php echo CHtml::link(Yii::t('tasks', 'CreateTasks'), Yii::app()->controller->createUrl('create'), array('class' => 'button')); ?> <?php if ($model->user_id == Yii::app()->user->id && $model->status_id == Status::STATUS_PENDING) { ?>
<?php echo CHtml::link("#" . $data->task_id . " - " . CHtml::encode($data->task_name), array('tasks/view', 'id' => $data->task_id)); ?> </h3> <?php echo ECHtml::word_split(CHtml::encode($data->task_description), 20) . "..."; ?> <br /> </div> <div class="grid_5"> <span style="float:right" class="priority pr<?php echo CHtml::encode($data->task_priority); ?> "> <?php echo Tasks::getNameOfTaskPriority($data->task_priority); ?> </span> <?php if (Users::countWorkersByTask($data->task_id) > 0) { ?> <div style="float:left;"> <?php echo CHtml::image(Yii::app()->request->baseUrl . '/images/collaborators.png', '', array('style' => 'vertical-align:middle;')) . " " . CHtml::link(Yii::t('tasks', 'viewCollaborators'), Yii::app()->createUrl('tasks/ShowWorkers', array('id' => $data->task_id)), array('class' => 'viewCollaborators')); ?> </div> <?php } ?> <?php if (substr($data->task_startDate, 0, 10) != '0000-00-00') {
/** * Displays a particular model. * @return string with success message */ public function actionView($id) { // check if user has permission to viewMilestones if (Yii::app()->user->checkAccess('viewMilestones')) { // get Invoice object model $model = $this->loadModel($id); // Tasks dataprovider $dataProviderTasks = Tasks::model()->findAll(array('condition' => 't.milestone_id = :milestone_id', 'params' => array(':milestone_id' => $model->milestone_id), 'order' => 't.status_id ASC, t.task_priority DESC')); // finding by status $criteria = new CDbCriteria(); $criteria->select = "count(t.status_id) as total"; $criteria->condition = "t.milestone_id = :milestone_id"; $criteria->params = array(':milestone_id' => $id); $criteria->group = "t.status_id"; $foundTasksStatus = Tasks::model()->with('Status')->together()->findAll($criteria); $TasksStatus = array(); foreach ($foundTasksStatus as $task) { $TasksStatus[] = array('name' => $task->Status->status_name, 'data' => intval($task->total)); } // finding by priority $criteria = new CDbCriteria(); $criteria->select = "t.task_priority, count(t.task_priority) as total"; $criteria->condition = "t.milestone_id = :milestone_id"; $criteria->params = array(':milestone_id' => $id); $criteria->group = "t.task_priority"; $foundTasksPriority = Tasks::model()->findAll($criteria); $TasksPriority = array(); foreach ($foundTasksPriority as $task) { $TasksPriority[] = array(Tasks::getNameOfTaskPriority($task->task_priority), intval($task->total)); } // output view $this->render('view', array('model' => $model, 'percent' => Milestones::model()->getMilestonePercent($model->milestone_id), 'dataProviderTasks' => $dataProviderTasks, 'TasksStatus' => $TasksStatus, 'TasksPriority' => $TasksPriority)); } else { throw new CHttpException(403, Yii::t('site', '403_Error')); } }