/**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $step = $this->loadModel($id);
     $issue = null;
     if (isset($_GET['issueId'])) {
         if ($_GET['issueId'] != '') {
             $issue = Issue::model()->find('id=' . $_GET['issueId']);
         }
         if ($issue) {
             if ($issue->status == 0) {
                 $this->layout = "//layouts/column1";
             }
         }
     }
     if (isset($_POST['position'])) {
         $step->sortElement($_POST['position']);
         exit("ok");
     }
     $comment = $this->createComment($step, $issue);
     $element = $this->createElement($step);
     $text = $this->createText($step);
     $subStepModel = $this->createSubStep($step);
     $file = $this->createFile($step);
     $link = $this->createLink($step);
     $this->render('view', array('model' => $step, 'comment' => $comment, 'element' => $element, 'file' => $file, 'link' => $link, 'text' => $text, 'subStepModel' => $subStepModel, 'issue' => $issue));
 }
Пример #2
0
 public function loadIssue($id)
 {
     $model = Issue::model()->find("id = {$id}");
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #3
0
 public function testGetTypes()
 {
     $options = Issue::model()->typeOptions;
     $this->assertTrue(is_array($options));
     $this->assertTrue(3 == count($options));
     $this->assertTrue(in_array('Bug', $options));
     $this->assertTrue(in_array('Feature', $options));
     $this->assertTrue(in_array('Task', $options));
 }
Пример #4
0
 public function testGetStatus()
 {
     $options = Issue::model()->statusOptions;
     $this->assertTrue(is_array($options));
     $this->assertTrue(3 == count($options));
     $this->assertTrue(in_array('Not yet started', $options));
     $this->assertTrue(in_array('Started', $options));
     $this->assertTrue(in_array('Finished', $options));
 }
Пример #5
0
 public function actionDelete($id)
 {
     // make sure we have that id
     $issue = Issue::model()->findByPk($id);
     if (!$issue) {
         $this->sendError("Sorry, That issue was not found.");
     }
     $issue->delete();
     $this->send("");
 }
Пример #6
0
 public function getTravelersList()
 {
     $new = Yii::t('default', 'New Version Pending');
     $travelerId = Issue::model()->findColumn('travelerId', 'equipmentId = ' . $this->id);
     $notIn = "";
     if ($travelerId) {
         $ids = '';
         foreach ($travelerId as $id) {
             $traveler = Traveler::model()->findByPk($id);
             if ($traveler->parentId) {
                 $ids .= $traveler->parentId . ',';
             } else {
                 $ids .= $traveler->id . ',';
             }
         }
         if ($ids != '') {
             $ids = substr($ids, 0, -1);
             $notIn = "AND (parentId NOT IN ({$ids}) OR parentId IS NULL)";
             //exit($notIn);
         }
     }
     $criteria = new CDbCriteria();
     /*$criteria->select = array("CASE status WHEN 0 THEN name+' (v'+CAST(revision as varchar)+')' ELSE name+' (v'+CAST(revision as varchar)+') -> !!$new' END as name", "id"); ORACLE*/
     $criteria->select = array("CASE status WHEN 0 THEN CONCAT(name, ' (v',   revision,  ')') ELSE CONCAT(name, ' (v', revision, ') -> !!{$new}') END as name", "id");
     $criteria->condition = "componentId = {$this->componentId} AND status < 1 {$notIn}";
     $criteria->addNotInCondition('id', $travelerId);
     $travelers = Traveler::model()->findAll($criteria);
     if ($travelers) {
         return CHtml::listData($travelers, 'id', 'name');
     } else {
         return false;
     }
 }
Пример #7
0
	/**
	 * 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.
	 */
	public function loadModel($withComments=false)
	{
		if($this->_model===null)
		{
			if(isset($_GET['id']))
			{
			     if($withComments)
			     {
				      $this->_model=Issue::model()->with(array(
					                     'comments'=>array('with'=>'author')))->findbyPk($_GET['id']);
				 }
			     else
			     {
				      $this->_model=Issue::model()->findbyPk($_GET['id']);
			     }
			}
			if($this->_model===null)
				throw new CHttpException(404,'The requested page does not exist.');
		}
		return $this->_model;
	}
Пример #8
0
<?php

/* @var $this StaffController */
/* @var $model Staff */
$this->breadcrumbs = array('Staff' => array('index'), $model->id);
$this->menu = array(array('label' => 'List Staff', 'url' => array('index')), array('label' => 'Create Staff', 'url' => array('create')), array('label' => 'Update Staff', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete Staff', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage Staff', 'url' => array('admin')));
?>

<h1>View Staff #<?php 
echo $model->id;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'fullName', 'usrName', 'email', 'locationname', 'payrollNo')));
?>

<?php 
$query = Issue::model()->findAllByAttributes(array('fk_staff' => $model->id));
$dataProvider = new CArrayDataProvider($rawData = $query);
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'columns' => array(array('name' => 'id', 'header' => 'ID'), array('name' => 'componenttag', 'header' => 'Device TagNo'), array('name' => 'dateIssued', 'header' => 'Date Issued'), array('name' => 'dateReturned', 'header' => 'Date Returned'), array('name' => 'locationname', 'header' => 'Location'), array('name' => 'hostname', 'header' => 'HostName'))));
Пример #9
0
 public function getIssueByPkFk($travelerId, $equipmentId)
 {
     $issue = Issue::model()->find("travelerId = {$travelerId} AND equipmentId = {$equipmentId}");
     if ($issue) {
         return $issue;
     } else {
         return null;
     }
 }
Пример #10
0
 public function setLinks()
 {
     if ($this->deviceStatus == 'In Store') {
         return CHtml::link("Issue", array("Issue/create", "fk_componentDetail" => $this->id));
     } else {
         if ($this->deviceStatus == 'In Use') {
             $criteria = new CDbCriteria();
             $criteria->condition = "fk_componentDetail = " . $this->id;
             $criteria->order = "id desc";
             $criteria->limit = 1;
             $issue = Issue::model()->findAll($criteria);
             if ($issue) {
                 return CHtml::link("Return", array("Issue/update", "id" => $issue[0]['id']));
             }
         } else {
             return "";
         }
     }
 }
 public function getTravelerName($id)
 {
     $id = (int) $id;
     $criteria = new CDbCriteria();
     $criteria->condition = "id={$id}";
     $issue = Issue::model()->find($criteria);
     //$issue= Issue::model()->findByPk($id); doesnt work!why?
     $traveler = Traveler::model()->findByPk($issue->travelerId);
     return $traveler->name;
 }
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $this->layout = "//layouts/column1";
     if (isset($_GET['issueId'])) {
         $issue = Issue::model()->find("id = " . $_GET['issueId']);
         $dataProvider = new CActiveDataProvider('Discrepancy', array('criteria' => array('condition' => "issueId = {$issue->id}")));
         $this->render('index', array('dataProvider' => $dataProvider, 'issue' => $issue));
     } else {
         $model = new Discrepancy('search');
         $model->unsetAttributes();
         // clear any default values
         if (isset($_GET['Discrepancy'])) {
             $model->attributes = $_GET['Discrepancy'];
         }
         $this->render('admin', array('model' => $model));
     }
 }
Пример #13
0
<div class="view">
    
        <?php 
$issue = Issue::model()->getIssueByPkFk($data->id, $equipmentId);
$issueId = $issue->id;
$progress = $issue->progressText;
?>

	<?php 
echo CHtml::link(CHtml::encode($data->name) . " (v{$data->revision})", array('issue/view', 'id' => $issueId)) . " <b>({$progress})</b>";
?>

</div>
Пример #14
0
 /**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id, $withComments = false)
 {
     if ($withComments) {
         $model = Issue::model()->with(array('comments' => array('with' => 'author')))->findByPk($id);
     } else {
         $model = Issue::model()->findByPk($id);
     }
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #15
0
 /**
  * Remove an issue assignment for this event.
  *
  * @param $name
  *
  * @return bool
  */
 public function deleteIssue($name)
 {
     if (!($issue = Issue::model()->find('name=?', array($name)))) {
         return false;
     }
     foreach (EventIssue::model()->findAll('event_id=? and issue_id = ?', array($this->id, $issue->id)) as $event_issue) {
         $event_issue->delete();
     }
     return true;
 }
 public function actionCloseout($id)
 {
     $model = $this->loadModel($id);
     $model->status = 0;
     $model->scenario = 'closeout';
     $issue = Issue::model()->find("id =" . $model->issueId);
     if (!$issue) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Nonconformity'])) {
         $model->attributes = $_POST['Nonconformity'];
         $model->closedById = Yii::app()->user->id;
         $model->closedTime = new CDbExpression('NOW()');
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('closeout', array('model' => $model, 'issue' => $issue));
 }
Пример #17
0
<?php

/* @var $this LocationController */
/* @var $model Location */
$this->breadcrumbs = array('Locations' => array('index'), $model->name);
$this->menu = array(array('label' => 'List Location', 'url' => array('index')), array('label' => 'Create Location', 'url' => array('create')), array('label' => 'Update Location', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete Location', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage Location', 'url' => array('admin')));
?>

<h1>View Location #<?php 
echo $model->id;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'name')));
?>

<?php 
$query = Issue::model()->findAllByAttributes(array('fk_location' => $model->id));
$dataProvider = new CArrayDataProvider($rawData = $query);
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'columns' => array(array('name' => 'id', 'header' => 'ID'), array('name' => 'componenttag', 'header' => 'Device TagNo'), array('name' => 'staffname', 'header' => 'Staff Name'), array('name' => 'dateIssued', 'header' => 'Date Issued'), array('name' => 'dateReturned', 'header' => 'Date Returned'), array('name' => 'hostname', 'header' => 'HostName'))));
Пример #18
0
<?php

/* @var $this ComponentdetailController */
/* @var $model Componentdetail */
$this->breadcrumbs = array('Component Details' => array('index'), $model->id);
$this->menu = array(array('label' => 'List Component Details', 'url' => array('index')), array('label' => 'Create Component Details', 'url' => array('create')), array('label' => 'Update Component Details', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete Component Details', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage Component Details', 'url' => array('admin')));
?>

<h1>View Componentdetail #<?php 
echo $model->id;
?>
</h1>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'componenttypename', 'tagNo', 'serialNo', 'description', 'project', 'suppliername', 'lpoNo', 'purchaseDate', 'purchaseValue', 'deviceStatus', 'comment', 'note')));
?>

<?php 
$query = Issue::model()->findAllByAttributes(array('fk_componentDetail' => $model->id));
$dataProvider = new CArrayDataProvider($rawData = $query);
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'columns' => array(array('name' => 'id', 'header' => 'ID'), array('name' => 'staffname', 'header' => 'Staff Name'), array('name' => 'dateIssued', 'header' => 'Date Issued'), array('name' => 'dateReturned', 'header' => 'Date Returned'), array('name' => 'locationname', 'header' => 'Location'), array('name' => 'hostname', 'header' => 'HostName'))));
Пример #19
0
 public function init()
 {
     $this->issues = Issue::model()->findmyIssues();
 }
Пример #20
0
 /**
  * Gets Previous Minutes.
  */
 private function getPreviousMinutes($id_rapat)
 {
     $criteria = new CDbCriteria();
     $criteria->params = array(':userName' => $value1, ':email' => $value2);
     $usermodel = User::model()->find($criteria);
     $criteria = new CDbCriteria();
     $criteria->join = 'inner join agenda_rapat on agenda.id=id_agenda';
     $criteria->condition = "status='IPG' OR status='OPN' OR status='PND' AND ";
     $models = Issue::model()->with('subjects', 'voteCount')->findAll($criteria);
     $prevMinutes = AgendaRapat::model()->findAllByAttributes(array('id_rapat' => $id_rapat));
     return $prevMinutes;
 }
Пример #21
0
 public function getEquipment()
 {
     return Issue::model()->find("id = {$this->issueId}")->equipment;
 }
Пример #22
0
        ?>
                        <ul>
                        <?php 
    }
    ?>


                        <li><span class='equipment'><?php 
    echo CHtml::link($ename, array('view', 'id' => $eid));
    ?>
</span>
                            <?php 
    if ($travelers) {
        echo "<ul>";
        foreach ($travelers as $traveler) {
            $issue = Issue::model()->getIssueByPkFk($traveler->id, $eid);
            $issueId = $issue->id;
            ?>
                                <li><span class='file'><?php 
            echo CHtml::link(CHtml::encode($traveler->name) . " (v{$traveler->revision})", array('issue/view', 'id' => $issueId));
            ?>
</span></li>
                                    <?php 
        }
        echo "</ul>";
    }
    ?>
                </li>
                <?php 
    $componentId = $cid;
    $ul = "</ul></li>";
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $this->layout = "//layouts/column1";
     $issue = null;
     if (isset($_GET['issueId'])) {
         $issueId = $_GET['issueId'];
         $issue = Issue::model()->find("id = {$issueId}");
     } else {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $dataProvider = new CActiveDataProvider('Comment', array('criteria' => array('condition' => "issueId = {$issueId}", 'order' => 'stepId')));
     $this->render('index', array('dataProvider' => $dataProvider, 'issue' => $issue));
 }
Пример #24
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $discrepancyId = null;
     if (isset($_GET['discrepancyId'])) {
         $discrepancyId = $_GET['discrepancyId'];
         $discrepancy = Nonconformity::model()->findByPk($discrepancyId);
         $issue = Issue::model()->find("id = {$discrepancy->issueId}");
         $step = $discrepancy->step;
     } else {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     if (!$discrepancy->visible) {
         $this->layout = "//layouts/column1";
     }
     $dataProvider = new CActiveDataProvider('File', array('criteria' => array('condition' => "discrepancyId={$discrepancyId}")));
     $this->render('index', array('dataProvider' => $dataProvider, 'step' => $step, 'issue' => $issue, 'discrepancy' => $discrepancy));
 }