Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Topictype::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['TopicTypeId' => $this->TopicTypeId]);
     $query->andFilterWhere(['like', 'Name', $this->Name])->andFilterWhere(['like', 'Color', $this->Color]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTopicType()
 {
     return $this->hasOne(Topictype::className(), ['TopicTypeId' => 'TopicTypeId']);
 }
Пример #3
0
 /**
  * Finds the Topictype model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Topictype the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Topictype::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #4
0
use yii\widgets\ActiveForm;
use backend\models\Topictype;
/* @var $this yii\web\View */
/* @var $model backend\models\Topic */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="topic-form">

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

    <!--?= $form->field($model, 'TopicTypeId')->textInput() ?-->
    <?php 
echo $form->field($model, 'TopicTypeId')->dropDownList(ArrayHelper::map(Topictype::find()->all(), 'TopicTypeId', 'Name'), ['prompt' => 'Select topic Type']);
?>

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

    <?php 
echo $form->field($model, 'ParentTopicId')->textInput();
?>

    <?php 
echo $form->field($model, 'TopicOrder')->textInput();
?>

    <?php 
Пример #5
0
 public function actionGet($id)
 {
     $topictype = Topictype::find()->where("topictypeid=" . $id)->one();
     $data = Documenttype::find()->where("TopicTypeId=" . $id)->all();
     /* foreach($data as $d){
            $arr['name'] = $d['Name'];
            $arr['documentTypeId'] = $d['DocumentTypeId'];
            $arr['topicTypeId'] = $d['TopicTypeId'];
            array_push($returnArray, $arr);
        }*/
     //echo json_encode($returnArray);
     //print_r($data);
     return $this->render('get', array('documenttype' => $data, 'topictype' => $topictype));
 }