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


PHP Test::model方法代码示例

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


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

示例1: test_1Action

 public function test_1Action()
 {
     $model = Test::model();
     $starttime = explode(' ', microtime());
     for ($i = 0; $i < 1; $i++) {
         $data = $model->where('id', $i)->page(1, 4)->find();
     }
     debug($data);
     //程序运行时间
     $endtime = explode(' ', microtime());
     $thistime = $endtime[0] + $endtime[1] - ($starttime[0] + $starttime[1]);
     $thistime = round($thistime, 3);
     echo "本网页执行耗时:" . $thistime . " 秒。" . time();
     echo 'hello world';
 }
开发者ID:seaice,项目名称:li,代码行数:15,代码来源:SiteController.php

示例2: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     Yii::log("Mi primer log", "info", "application.controllers.SiteController");
     Yii::log("eeeeee error", "error", "application.controllers.SiteController");
     Yii::log("wwwwwwwwww warning", "warning", "application.controllers.SiteController");
     Yii::log("Mi primer trace", "trace", "application.controllers.SiteController");
     Yii::log("001#Venta en el sitio tal 1", "info", "application.controllers.SiteController.ref");
     Yii::log("003#Venta en el sitio tal 2", "info", "application.controllers.SiteController.ref");
     Yii::log("002#Venta en el sitio tal 3", "info", "application.controllers.SiteController.ref");
     Yii::beginProfile("miProfileBucleFor", "application.controllers.SiteController");
     for ($x = 0; $x < 100; $x++) {
         echo "";
     }
     Yii::endProfile("miProfileBucleFor", "application.controllers.SiteController");
     Yii::beginProfile("miProfileBucleFor", "application.controllers.SiteController");
     sleep(1);
     Yii::endProfile("miProfileBucleFor", "application.controllers.SiteController");
     Yii::app()->db->createCommand("SELECT * FROM test")->queryAll();
     Test::model()->findAll();
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $this->render('index');
 }
开发者ID:patelh18,项目名称:yii-tutorials,代码行数:27,代码来源:SiteController.php

示例3: 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($id)
 {
     if ($_GET['group_id'] == 1) {
         //check exist course and test created by a trainer
         if (Course::model()->checkCourse($id) && Test::model()->checkTest($id)) {
             Yii::app()->user->setFlash('unsuccess', ' Can not delete a trainer.');
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin', 'group_id' => $_GET['group_id']));
         }
         // delete trainer
         $this->loadModel($id)->delete();
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             Yii::app()->user->setFlash('success', 'You did delete a trainer when: <br>- Not exist course created by trainer.<br>- Not exist test created by trainer.');
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin', 'group_id' => $_GET['group_id']));
         }
     } elseif ($_GET['group_id'] == 2) {
         //Delete course trainee
         CourseTrainee::model()->deleteCourseTrainee($id);
         //Delete user test
         UserTest::model()->deleteUserTest($id);
         //Delete training log and training random question
         TrainingLog::model()->deleteTrainingLog($id);
         TrainingRandomquestion::model()->deleteTrainingRadomQuestion($id);
         //delete trainee
         $this->loadModel($id)->delete();
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         Yii::app()->user->setFlash('success', 'You did delete a trainee: <br>- Delete course trainee.<br>- Delete Training log and training random question.<br>- Delete user test and user answers.');
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin', 'group_id' => $_GET['group_id']));
         }
     } elseif ($_GET['group_id'] == 3) {
         // delete training manager
         $this->loadModel($id)->delete();
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         Yii::app()->user->setFlash('success', 'You did delete a training manager.');
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin', 'group_id' => $_GET['group_id']));
         }
     } elseif ($_GET['group_id'] == 4) {
         // delete team leader
         ATrainingTeam::deleteTeamleader($id);
         $this->loadModel($id)->delete();
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         Yii::app()->user->setFlash('success', 'You did delete a team leader.');
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin', 'group_id' => $_GET['group_id']));
         }
     }
 }
开发者ID:nguyendvphp,项目名称:onlinetraining,代码行数:54,代码来源:AUserController.php

示例4: actionGeneratePdf

 public function actionGeneratePdf()
 {
     $session = new CHttpSession();
     $session->open();
     Yii::import('application.extensions.giiplus.bootstrap.*');
     require_once 'tcpdf/tcpdf.php';
     require_once 'tcpdf/config/lang/eng.php';
     if (isset($session['Test_records'])) {
         $model = $session['Test_records'];
     } else {
         $model = Test::model()->findAll();
     }
     $html = $this->renderPartial('expenseGridtoReport', array('model' => $model), true);
     //die($html);
     $pdf = new TCPDF();
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor(Yii::app()->name);
     $pdf->SetTitle('Test Report');
     $pdf->SetSubject('Test Report');
     //$pdf->SetKeywords('example, text, report');
     $pdf->SetHeaderData('', 0, "Report", '');
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by " . Yii::app()->name, "");
     $pdf->setHeaderFont(array('helvetica', '', 8));
     $pdf->setFooterFont(array('helvetica', '', 6));
     $pdf->SetMargins(15, 18, 15);
     $pdf->SetHeaderMargin(5);
     $pdf->SetFooterMargin(10);
     $pdf->SetAutoPageBreak(TRUE, 0);
     $pdf->SetFont('dejavusans', '', 7);
     $pdf->AddPage();
     $pdf->writeHTML($html, true, false, true, false, '');
     $pdf->LastPage();
     $pdf->Output("Test_002.pdf", "I");
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:34,代码来源:TestController.php

示例5: model

 /**
  * Returns the static model of the specified AR class.
  * Please note that you should have this exact method in all your CActiveRecord descendants!
  * @param string $className active record class name.
  * @return WTest the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
开发者ID:nguyendvphp,项目名称:onlinetraining,代码行数:10,代码来源:WTest.php

示例6: array

<?php

$this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Manage'));
$this->menu = array(array('label' => Yii::t('app', 'List') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Create') . ' ' . $model->label(), 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('test2-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1><?php 
echo Yii::t('app', 'Manage') . ' ' . GxHtml::encode($model->label(2));
?>
</h1>

<p>
You may optionally enter a comparison operator (&lt;, &lt;=, &gt;, &gt;=, &lt;&gt; or =) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php 
echo GxHtml::link(Yii::t('app', 'Advanced Search'), '#', array('class' => 'search-button'));
?>
<div class="search-form">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'test2-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', array('name' => 'test_id', 'value' => 'GxHtml::valueEx($data->test)', 'filter' => GxHtml::listDataEx(Test::model()->findAllAttributes(null, true))), 'name', array('class' => 'CButtonColumn'))));
开发者ID:subhra-sekhar,项目名称:yiitest,代码行数:27,代码来源:admin.php

示例7: 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Test::model()->with('integration', 'system', 'unit', 'validation')->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     /*if ( $model->integration != null )
                $model = $model->integration;
            else if ( $model->system != null )
                $model = $model->system;
            else if ( $model->unit != null )
                $model = $model->unit;
            else if ( $model->validation != null )
                $model = $model->validation;
            else
     		throw new CHttpException(404,'The requested page does not exist.');*/
     return $model;
 }
开发者ID:black2279,项目名称:Tracy-openshift,代码行数:23,代码来源:TestController.php

示例8: 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 Test the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Test::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:renlong567,项目名称:YiiYurenGithub,代码行数:15,代码来源:TestController.php


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