Ejemplo n.º 1
0
 protected function findModel($id)
 {
     if (($model = MPhoto::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MPhoto::find()->where(['gh_id' => Yii::$app->user->getGhid()])->orderBy('photo_id DESC');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['photo_id' => $this->photo_id, 'sort_order' => $this->sort_order, 'create_time' => $this->create_time]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'pic_url', $this->pic_url]);
     return $dataProvider;
 }
Ejemplo n.º 3
0
 public function getPhoto()
 {
     return $this->hasOne(MPhoto::className(), ['photo_id' => 'photo_id']);
 }
Ejemplo n.º 4
0
use app\models\MGh;
use app\models\MPhoto;
use vova07\imperavi\Widget;
/* @var $this yii\web\View */
/* @var $model app\models\MArticle */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="marticle-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'photo_id')->dropDownList(\yii\helpers\ArrayHelper::map(MPhoto::find()->where(['gh_id' => Yii::$app->user->getGhid()])->all(), 'photo_id', 'title'));
?>

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => 128]);
?>

    <?php 
echo $form->field($model, 'author')->textInput(['maxlength' => 64]);
?>

    <?php 
echo $form->field($model, 'digest')->textInput(['maxlength' => 256]);
?>

    <!--