当前位置: 首页>>代码示例>>PHP>>正文


PHP FormField::model方法代码示例

本文整理汇总了PHP中FormField::model方法的典型用法代码示例。如果您正苦于以下问题:PHP FormField::model方法的具体用法?PHP FormField::model怎么用?PHP FormField::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FormField的用法示例。


在下文中一共展示了FormField::model方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionDelete

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete()
 {
     if (isset($_GET['form'])) {
         $form_id = $_GET['form'];
         $model = Form::model()->findByPk($form_id);
         $table_name = $model->TABLE_NAME;
         $this->loadModel($form_id)->delete();
         if (Yii::app()->db->schema->getTable($table_name)) {
             Yii::app()->db->createCommand()->dropTable($table_name);
             FormField::model()->deleteAllByAttributes(array('FORM_ID' => $form_id));
         }
     } else {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('all'));
     }
 }
开发者ID:anjanababu,项目名称:Asset-Management,代码行数:24,代码来源:FormsController.php

示例2: getFields

 public static function getFields()
 {
     $form_id = Yii::app()->params['form-id'];
     self::$_model = FormField::model()->findAllByAttributes(array('FORM_ID' => $form_id), array('order' => 'POSITION ASC'));
     return self::$_model;
 }
开发者ID:anjanababu,项目名称:Asset-Management,代码行数:6,代码来源:Entry.php

示例3: actionView

 public function actionView()
 {
     if (isset($_GET['form'])) {
         $table_id = $_GET['form'];
         if (isset($_GET['entry'])) {
             $entry_id = $_GET['entry'];
             $fields = FormField::model()->findAllByAttributes(array('FORM_ID' => $table_id), array('order' => 'POSITION ASC'));
         } else {
             $entry_id = NULL;
         }
     } else {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $this->render('view', array('model' => $this->loadModel($table_id, $entry_id), 'table_id' => $table_id, 'entry_id' => $entry_id, 'fields' => $fields, 'form' => Form::model()->findByPk($table_id)));
 }
开发者ID:anjanababu,项目名称:Asset-Management,代码行数:15,代码来源:EntryController.php

示例4: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return FormField the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = FormField::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:anjanababu,项目名称:Asset-Management,代码行数:15,代码来源:FieldsController.php


注:本文中的FormField::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。