public function run()
 {
     /*$this->widget('zii.widgets.CListView', array(
           'dataProvider' => $this->arrDataProvider,
           'itemView'=>'newview',
           'summaryText'=>'',
       ));*/
     $data = $this->arrDataProvider->getData();
     $records = PartStatus::model()->findAll();
     foreach ($data as $this->item_id => $item) {
         $this->status = PartStatus::model()->findByPk($item->status_id);
         $this->record_id = $item->id;
         $this->status_id = $item->status_id;
         $this->status = $this->status->status;
         $this->select = "\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\tfunction status_changed_{$this->record_id}( item_id ){\n\t\t\t\t\t\tvar status_id = document.getElementById('select-status-{$this->record_id}').value;\n\t\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\t\t\turl:'http://'+document.domain+'/project/zakaz/status'\n\t\t\t\t\t\t\t, data : 'cmd=status&status_id='+status_id+'&id='+item_id\n\t\t\t\t\t\t\t, success: function(html) {\n\t\t\t\t\t\t\t\thtml = BackReplacePlusesFromStr(html);\n\t\t\t\t\t\t\t\tajax_response = html;\n\t\t\t\t\t\t\t\tif (html != 'null') {\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t</script>";
         $this->select .= '<select name="select-status-' . $this->record_id . '" id="select-status-' . $this->record_id . '" onchange="status_changed_' . $this->record_id . '(' . $this->record_id . '); return false;">';
         foreach ($records as $rec) {
             $this->select .= "<option value='{$rec->id}' ";
             if ($rec->id == $item->status_id) {
                 $this->select .= 'selected="selected"';
             }
             $this->select .= ">{$rec->status}</option>";
         }
         $this->select .= '</select>';
         $this->render('newview', $item);
     }
 }
 public function run()
 {
     /*$this->widget('zii.widgets.CListView', array(
           'dataProvider' => $this->arrDataProvider,
           'itemView'=>'newview',
           'summaryText'=>'',
       ));*/
     $data = $this->arrDataProvider->getData();
     $records = PartStatus::model()->findAll();
     $number = 0;
     foreach ($data as $this->item_id => $item) {
         $number++;
         if (User::model()->isCustomer() && $item->status_id == 4) {
             $this->status = ProjectModule::t('Approved by me');
         } else {
             $this->status = PartStatus::model()->findByPk($item->status_id);
             $this->status = $this->status->status;
         }
         $this->record_id = $item->id;
         $this->status_id = $item->status_id;
         $this->select = '<select name="select-status-' . $this->record_id . '" id="select-status-' . $this->record_id . '" onchange="stage_change_status(' . $this->record_id . '); return false;">';
         foreach ($records as $rec) {
             $this->select .= "<option value='{$rec->id}' ";
             if ($rec->id == $item->status_id) {
                 $this->select .= 'selected="selected"';
             }
             $this->select .= ">{$rec->status}</option>";
         }
         $this->select .= '</select>';
         if (Yii::app()->user->isGuest || User::model()->isAuthor() && !User::model()->isExecutor($item->proj_id)) {
             $this->number = $number;
             $this->render('index', $item);
         } else {
             $this->render('newview', $item);
         }
     }
 }
 /**
  * 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 PartStatus the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = PartStatus::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('site', 'The requested page does not exist.'));
     }
     return $model;
 }
Exemplo n.º 4
0
 public function getLastPartStatus()
 {
     if ($this->_lastPartStatus === null && $this->parts !== null) {
         if ($this->parts[0]->status_id != PartStatus::COMPLETED) {
             $this->_lastPartStatus = PartStatus::getStatus($this->parts[0]->status_id);
         } else {
             $this->_lastPartStatus = '';
         }
     }
     return $this->_lastPartStatus;
 }