예제 #1
0
파일: Doclad.php 프로젝트: mosedu/confprof
 /**
  * Сохраняем участников или консультантов
  *
  * @param $data array
  * @param $nType integer
  */
 public function savePersons($data, $nType)
 {
     $bOk = true;
     Person::updateAll(['prs_active' => 0, 'prs_type' => 0, 'prs_sec_id' => 0, 'prs_doc_id' => 0], ['prs_doc_id' => $this->doc_id, 'prs_type' => $nType]);
     foreach ($data as $ob) {
         $ob['prs_type'] = $nType;
         $ob['prs_doc_id'] = $this->doc_id;
         $ob['prs_active'] = Person::PERSON_STATE_ACTIVE;
         $ob['prs_sec_id'] = $this->doc_sec_id;
         //            Yii::info('consultant = ' . print_r($ob, true));
         $s = 'Update ' . Person::tableName() . ' Set ';
         $param = [];
         $sDelim = '';
         if (empty($ob['prs_org']) && !empty($ob['prs_hischool'])) {
             $ob['prs_org'] = $ob['prs_hischool'];
         }
         foreach ($ob as $k => $v) {
             $s .= $sDelim . $k . ' = ' . ':' . $k;
             $param[':' . $k] = $v;
             $sDelim = ', ';
         }
         $s .= ' Where prs_active = 0 And prs_type = 0 And prs_sec_id = 0 And prs_doc_id = 0 Limit 1';
         //            Yii::info($s);
         $n = Yii::$app->db->createCommand($s, $param)->execute();
         if ($n == 0) {
             $oNew = new Person();
             $oNew->prs_type = $nType;
             $aTmp = $oNew->scenarios();
             $oNew->attributes = $ob;
             $oNew->prs_doc_id = $this->doc_id;
             $oNew->prs_active = Person::PERSON_STATE_ACTIVE;
             $oNew->prs_sec_id = $this->doc_sec_id;
             if (!$oNew->save()) {
                 $bOk = false;
                 Yii::info('savePersons() nType = ' . $nType . ' attributes: ' . print_r($oNew->attributes, true));
                 Yii::info('savePersons() nType = ' . $nType . ' Error save oNew: ' . print_r($oNew->getErrors(), true));
             }
         }
     }
     return $bOk;
 }
예제 #2
0
파일: _form.php 프로젝트: mosedu/confprof
use app\assets\CharcounterAsset;
use mosedu\multirows\MultirowsWidget;
$sCss = <<<EOT
div.required label:after {
    content: " *";
/*    color: red;*/
}
.lio_but {
    white-space: nowrap;
}
EOT;
CharcounterAsset::register($this);
$this->registerCss($sCss);
$emptyConsultant = new Person();
$emptyConsultant->prs_type = Person::PERSON_TYPE_CONSULTANT;
$aTmp = $emptyConsultant->scenarios();
/* @var $this yii\web\View */
/* @var $model app\models\Doclad */
/* @var $form yii\widgets\ActiveForm */
/* @var $conference app\models\Conference */
$ekis_id = ['language' => 'ru', 'pluginOptions' => ['allowClear' => true, 'initSelection' => new JsExpression('function (element, callback) {
                    if( element.val() > 0 ) {
                        $.ajax({
                            method: "POST",
                            url: "http://hastur.temocenter.ru/task/eo.search/",
                            dataType: "json",
                            data: {
                                filters: {
                                    eo_id: element.val(),
                                },
                                maskarade: {