本文整理汇总了PHP中app\models\Person::scenarios方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::scenarios方法的具体用法?PHP Person::scenarios怎么用?PHP Person::scenarios使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Person
的用法示例。
在下文中一共展示了Person::scenarios方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: savePersons
/**
* Сохраняем участников или консультантов
*
* @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: Person
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: {