public function getFileName($field) { if (!isset($this->_fileName[$field])) { if (is_null($this->fields[$field]['translitField'])) { $this->_fileName[$field] = md5(microtime()) . '.' . pathinfo($this->_fileInstance[$field], PATHINFO_EXTENSION); } else { $this->_fileName[$field] = CommonHelper::translit($this->owner->{$this->fields[$field]['translitField']}) . '.' . pathinfo($this->_fileInstance[$field], PATHINFO_EXTENSION); } } return $this->_fileName[$field]; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Files::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 50], 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]); $query->andFilterWhere(['id' => $this->id, 'project_id' => $this->project_id]); if (isset($this->tagId)) { CommonHelper::addCriteriaForTagid($query, TagModel::MODEL_FILES, $this->tagId); } if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['like', 'file', $this->file]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Wiki::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $query->andFilterWhere(['id' => $this->id, 'project_id' => $this->project_id]); if (isset($this->tagId)) { CommonHelper::addCriteriaForTagid($query, TagModel::MODEL_WIKI, $this->tagId); } if (!($this->load($params) && $this->validate())) { //die(var_dump($query)); return $dataProvider; } $query->andFilterWhere(['like', 'title', $this->title]); return $dataProvider; }
"><i class="fa fa-angle-double-right"></i> <?php echo Yii::t('app', 'Provincias'); ?> </a></li> <li class="default<?php echo CommonHelper::startsWith(Yii::$app->controller->route, 'configuracion/datos/ciudades') ? ' active' : ''; ?> "><a href="<?php echo Url::to(['/configuracion/datos/ciudades']); ?> "><i class="fa fa-angle-double-right"></i> <?php echo Yii::t('app', 'Ciudades'); ?> </a></li> <li class="default<?php echo CommonHelper::startsWith(Yii::$app->controller->route, 'configuracion/datos/tipos-documento') ? ' active' : ''; ?> "><a href="<?php echo Url::to(['/configuracion/datos/tipos-documento']); ?> "><i class="fa fa-angle-double-right"></i> <?php echo Yii::t('app', 'Tipos de Documento'); ?> </a></li> </ul> </li> </ul> </section> <!-- /.sidebar --> </aside>
public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); CommonHelper::saveTags($this->tags, $this->getPrimaryKey(), TagModel::MODEL_FILES, $this->project_id); }
/** * Para limpiar los valores */ public function beforeValidate() { $this->fecha_nacimiento = CommonHelper::traducirFecha($this->fecha_nacimiento); return parent::beforeValidate(); }