public function actionUtil() { $model = new PersonSpecialityView('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['PersonSpecialityView'])) { $model->attributes = $_GET['PersonSpecialityView']; $out = ""; if (isset($_GET['renum'])) { $c = new CDbCriteria(); $c->compare("SepcialityID", $model->SepcialityID); $c->order = "CreateDate"; $pspes = Personspeciality::model()->findAll($c); foreach ($pspes as $i => $obj) { $out .= "RequestNumber: " . $obj->RequestNumber . " chaget to: " . ($i + 1) . "<br>"; $obj->RequestNumber = $i + 1; if ($obj->QualificationID > 1 && $obj->SepcialityID != 70686 && $obj->SepcialityID != 90661) { $obj->scenario = "SHORTFORM"; //$obj->CausalityID = 100; } if (!$obj->save()) { debug(print_r($obj->getErrors(), true)); } } } $this->render('sverka', array("model" => $model)); if (!empty($out)) { echo $out; } } else { $this->render('util'); } }
/** * Обновление цены за обучение * @param type $id */ public function actionStudupdate($id) { $model = $this->loadModel($id); $valid = true; if (isset($_POST['Personspeciality'])) { $model->attributes = $_POST['Personspeciality']; $valid = $model->validate() && $valid; try { if ($model->save()) { $model = new PersonSpecialityView('search'); } $model->unsetAttributes(); // clear any default values if (isset($_GET['PersonSpecialityView'])) { $model->attributes = $_GET['PersonSpecialityView']; } //$person = PersonSpecialityView::model()->findByPk($model->idPersonSpeciality); echo CJSON::encode(array("result" => "success", "data" => $this->renderPartial("//prices/tabs/_studprice", array('model' => $model), true))); Yii::app()->end(); } catch (Exception $e) { echo CJSON::encode(array("result" => "error", "data" => $e->getMessage())); Yii::app()->end(); } } $this->renderPartial('_studpriceModal', array('model' => $model, 'personid' => $model->idPersonSpeciality)); }
/** * 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) { $model = PersonSpecialityView::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
?> <p class="note">Поля, відмічені <span class="required">*</span> обов'язкові для заповнення!</p> <?php echo $form->errorSummary($model); //echo $form->errorSummary($model->personprice) ?> <div class="form well"> <?php //------------------------------------------------------------------------------------------------------------------------------------// ?> <div class="row-fluid"> <div class ="span4"> <?php $idperson = $model->idPersonSpeciality; $model->CustomerName = PersonSpecialityView::model()->find("idPersonSpeciality = {$idperson}")->FIO; echo $form->labelEx($model, 'CustomerName'); //,array('class'=>'span3')); ?> <?php echo $form->textField($model, 'CustomerName', array('id' => "CustomerName", 'class' => 'span12 ')); ?> <?php echo $form->error($model, 'CustomerName'); ?> </div> <div class ="span8"> <?php echo $form->labelEx($model, 'DocCustumer'); //,array('class'=>'span3')); ?>
$this->breadcrumbs = array('Contracts' => array('index'), $model->idContract); $this->menu = array(array('label' => 'Змінити запис', 'url' => array('update', 'id' => $model->idContract), 'icon' => " icon-pencil"), array('label' => 'Видалити запис', 'url' => '#', 'icon' => "icon-trash", 'linkOptions' => array('submit' => array('delete', 'id' => $model->idContract), 'confirm' => 'Ви впевнені, що хочете видалити цей елемент?')), array('label' => 'Переглянути записи', 'url' => array('admin'), 'icon' => "icon-list-alt")); ?> <h2>Контракт №<?php echo $model->ContractNumber; ?> від <?php echo $model->ContractDate; ?> </h2> <?php $specmodel = new PersonSpecialityView(); if ($model->isNewRecord) { $specmodel = PersonSpecialityView::model()->find("idPersonSpeciality = {$specid}"); } else { $specmodel = PersonSpecialityView::model()->find("idPersonSpeciality = " . $model->PersonSpecialityID); } $specid = $model->PersonSpecialityID; $url = Yii::app()->user->getPricePrintIP($specid); $model->PersonSpecialityID = $specmodel->SpecCodeName; $this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'type' => array('bordered', 'condensed', 'striped'), 'attributes' => array('idContract', 'PersonSpecialityID', 'ContractDate', 'CustomerName', 'CustomerDoc', 'CustomerPhone', 'CustomerAddress', 'CustomerPaymentDetails', 'PaymentDate', 'Comment'))); ?> <hr/> <?php $this->widget('bootstrap.widgets.TbButton', array('label' => 'Друкувати', 'type' => 'danger', 'size' => 'large', 'url' => $url, 'htmlOptions' => array('rel' => "prettyPhoto", 'title' => "Контракт"))); ?> <?php $this->beginWidget('ext.prettyPhoto.PrettyPhoto', array('id' => 'pretty_photo', 'options' => array('opacity' => 0.6, 'modal' => true))); $this->endWidget('ext.prettyPhoto.PrettyPhoto');
/** * Lists all models. */ public function actionIndex() { $model = new PersonSpecialityView('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['PersonSpecialityView'])) { $model->attributes = $_GET['PersonSpecialityView']; } $this->render('_personlist', array("model" => $model)); }