• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CController类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: renderList

 /**
  * @return rendered content from view as string.
  */
 public static function renderList(CController $controller, $dataProvider)
 {
     assert('$dataProvider instanceof RedBeanModelDataProvider');
     $auditEventsListView = new AuditEventsModalListView($controller->getId(), $controller->getModule()->getId(), 'AuditEvent', $dataProvider, 'modal');
     $view = new ModalView($controller, $auditEventsListView);
     return $view->render();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:AuditEventsListControllerUtil.php


示例2: isUserAllowed

 /**
  * Checks whether the Web user is allowed to perform the specified action.
  * @param CWebUser $user the user object
  * @param CController $controller the controller currently being executed
  * @param CAction $action the action to be performed
  * @param string $ip the request IP address
  * @param string $verb the request verb (GET, POST, etc.)
  * @return integer 1 if the user is allowed, -1 if the user is denied, 0 if the rule does not apply to the user
  */
 public function isUserAllowed($user, $controller, $action, $ip, $verb)
 {
     try {
         /*
         			$sesMod = $user->getState('modType');
         			$oCurMod = $controller->getModule();
         			if( $oCurMod != NULL ){
         				if( ($oCurMod->getId() == 'ad' && $sesMod == 'pub') ||
         					($oCurMod->getId() == 'pub' && $sesMod == 'ad') )
         					
         				throw new CHttpException(EXCEPTION_NO_RIGHTS, Yii::t('general', 'pub_ad_mod_confused'));	
         			}
         */
         echo 'user access';
         return false;
         $aPerm = $user->perm;
         $aAction = $aPerm[$controller->getId()]['_p'];
         if (is_array($aAction) && in_array(strtolower($action->getId()), $aAction)) {
             return true;
         } else {
             throw new CHttpException(EXCEPTION_NO_RIGHTS, Yii::t('general', 'sorry, you have no rights to do this'));
         }
     } catch (Exception $e) {
         throw new CHttpException(EXCEPTION_NO_RIGHTS, Yii::t('general', 'sorry, you have no rights to do this'));
     }
 }
开发者ID:wheatma,项目名称:react_study,代码行数:35,代码来源:UserAccessControl.php


示例3: renderList

 /**
  * @return rendered content from view as string.
  */
 public static function renderList(CController $controller, $dataProvider, $action)
 {
     assert('$dataProvider instanceof RedBeanModelDataProvider');
     $modalListLinkProvider = new UserDetailsModalListLinkProvider('users', 'default', 'details');
     $usersListView = new UsersByModelModalListView($controller->getId(), $controller->getModule()->getId(), $action, 'User', $modalListLinkProvider, $dataProvider, 'modal');
     $view = new ModalView($controller, $usersListView);
     return $view->render();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:11,代码来源:UsersByModelModalListControllerUtil.php


示例4: renderMailContent

 public function renderMailContent(CController $controller)
 {
     if ($this->templatePath) {
         $controller->renderPartial($this->getMailTemplatePath(), $this->getParamsToRender());
     } else {
         echo '';
     }
 }
开发者ID:shnellpavel,项目名称:bcgroup_lk,代码行数:8,代码来源:WizardFormModel.php


示例5: renderMessage

 public function renderMessage($view, array $data = array())
 {
     $controller = new \CController('SmsSender');
     $viewPath = \Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'views';
     $viewFile = $controller->resolveViewFile($view, $viewPath, $viewPath);
     $body = $controller->renderInternal($viewFile, $data, true);
     return $body;
 }
开发者ID:knyga,项目名称:sms-sender,代码行数:8,代码来源:SmsSender.php


示例6: generate

 public function generate()
 {
     $model = new MainAccountModel();
     $model->save();
     $ccc = new CController('context');
     $fileName = tempnam(sys_get_temp_dir(), "asd");
     $fileName .= ".html";
     $htmlOutput = $ccc->renderInternal(Yii::getPathOfAlias("application.views.templates") . '/index.php', $model->attributes, true);
     file_put_contents($fileName, $htmlOutput);
     return $fileName;
 }
开发者ID:branJakJak,项目名称:biOaypiaccount,代码行数:11,代码来源:TemplateGenerator.php


示例7: resolveBreadCrumbViewForDetailsControllerAction

 /**
  * @param CController $controller
  * @param $stickySearchKey
  * @param RedBeanModel $model
  * @return mixed
  */
 public static function resolveBreadCrumbViewForDetailsControllerAction(CController $controller, $stickySearchKey, RedBeanModel $model)
 {
     assert('is_string($stickySearchKey)');
     if (ArrayUtil::getArrayValue(GetUtil::getData(), 'stickyOffset') !== null && StickySearchUtil::getDataByKey($stickySearchKey) != null) {
         $stickyLoadUrl = Yii::app()->createUrl($controller->getModule()->getId() . '/' . $controller->getId() . '/renderStickyListBreadCrumbContent', array('stickyKey' => $stickySearchKey, 'stickyOffset' => ArrayUtil::getArrayValue(GetUtil::getData(), 'stickyOffset'), 'stickyModelId' => $model->id));
     } else {
         $stickyLoadUrl = null;
     }
     $className = static::resolveStickyDetailsAndRelationsBreadCrumbViewClassName();
     return new $className($controller->getId(), $controller->getModule()->getId(), static::resolveBreadcrumbLinks($model), $controller->getModule()->getModuleLabelByTypeAndLanguage('Plural'), $stickyLoadUrl);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:17,代码来源:StickySearchUtil.php


示例8: testDefaultProperties

 public function testDefaultProperties()
 {
     $app = new TestApplication();
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $c = new CController('test/subtest');
     $this->assertEquals($c->id, 'test/subtest');
     $this->assertEquals($c->filters(), array());
     $this->assertEquals($c->actions(), array());
     $this->assertNull($c->action);
     $this->assertEquals($c->defaultAction, 'index');
     $this->assertEquals($c->viewPath, $app->viewPath . DIRECTORY_SEPARATOR . 'test/subtest');
     $this->setExpectedException('CHttpException');
     $c->missingAction('index');
 }
开发者ID:super-d2,项目名称:codeigniter_demo,代码行数:14,代码来源:CControllerTest.php


示例9: _jump

 /**
  * 最终跳转处理
  * @param type $msg 提示信息
  * @param type $jumpurl 跳转url
  * @param type $wait 等待时间
  * @param int $type 消息类型 0或1
  */
 private static function _jump($msg = "", $jumpurl = "", $wait = 3, $type = 0)
 {
     $data = array('msg' => $msg, 'jumpurl' => $jumpurl, 'wait' => $wait, 'type' => $type);
     $data['title'] = $type == 1 ? "提示信息" : "错误信息";
     if (empty($jumpurl)) {
         if ($type == 1) {
             $data['jumpurl'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "javascript:window.close();";
         } else {
             $data['jumpurl'] = "javascript:history.back(-1);";
         }
     }
     $cc = new CController('showmessage');
     $cc->renderPartial("/showMessage", $data);
     exit;
 }
开发者ID:00606,项目名称:wechat,代码行数:22,代码来源:ShowMessage.php


示例10: handle

 public static function handle(CExceptionEvent $event)
 {
     $exception = $event->exception;
     if (get_class($exception) == "CHttpException" && $exception->statusCode === 404) {
         $pathParts = explode('/', Yii::app()->getRequest()->getRequestUri());
         $pathPart = array_pop($pathParts);
         $criteria = new CDbCriteria();
         $criteria->addSearchCondition('alias', $pathPart);
         $criteria->limit = 5;
         $models = Article::model()->findAll($criteria);
         $controller = new CController(null);
         $controller->renderPartial('//error/404', array('models' => $models));
         $event->handled = true;
     }
 }
开发者ID:moohwaan,项目名称:yii-application-cookbook-2nd-edition-code,代码行数:15,代码来源:NotFoundHandler.php


示例11: __construct

 /**
  * Initializes the pager by setting some default property values.
  * @param string $html
  * @param string $title
  * @param mixed $format
  * @param string $orientation
  */
 public function __construct($html, $title = '', $format = 'A4', $orientation = 'P')
 {
     parent::__construct($this->mode, $format, $this->defaultFontSize, $this->defaultFont, $this->marginLeft, $this->marginRight, $this->marginTop, $this->marginBottom, $this->marginHeader, $this->marginFooter, $orientation);
     $controller = new CController('PDF');
     $controller->layout = $this->layouts;
     $html = $controller->renderText($html, true);
     $this->SetCreator($this->creator);
     $this->SetTitle($title);
     if (!UserWeb::instance()->isGuest) {
         $this->SetFooter(sprintf('Berkas dicetak oleh %s, %s||{PAGENO}', UserWeb::instance()->user()->username, date('Y-m-d H:i:s')));
     } else {
         throw new CHttpException(403, 'Anda tidak memiliki otoritas untuk mengakses halaman ini');
     }
     $this->writeHTML($html);
 }
开发者ID:andryluthfi,项目名称:annotation-tools,代码行数:22,代码来源:PDFWriter.php


示例12: sendRequest

 public function sendRequest($hole, $user)
 {
     if (!$hole->isMoscow) {
         return false;
     }
     $client = $this->client;
     Yii::app()->request->baseUrl = Yii::app()->request->hostInfo;
     $pictures = array();
     foreach ($hole->pictures_fresh as $pict) {
         $pictures[] = array('name' => $pict->filename, 'fileType' => $pict->extension, 'content' => $pict->binary);
     }
     $answer = $client->RequestNew(array('request' => array('hidden' => false, 'informer' => array('name' => $this->name, 'surname' => $this->surname, 'fatherName' => $this->fatherName, 'phoneNumber' => $this->phoneNumber, 'email' => $this->email, 'notifyViaEmail' => $this->notifyViaEmail, 'notifyViaSms' => $this->notifyViaSms, 'address' => array('fullAddress' => $this->address)), 'category' => array('code' => $hole->type->dorogimos_id), 'details' => $this->details, 'address' => array('latitude' => $hole->LATITUDE, 'longitude' => $hole->LONGITUDE, 'fullAddress' => $this->holeAddress, 'webLink' => CController::createUrl('/holes/view', array('id' => $hole->ID))), 'pictures' => $pictures)));
     if ($answer->successful) {
         $holeRequest = new HoleRequests();
         $holeRequest->hole_id = $hole->ID;
         $holeRequest->user_id = $user->id;
         $holeRequest->date_sent = time();
         $holeRequest->response_requestid = $answer->request->requestNumber;
         $holeRequest->type = 'dorogimos';
         $holeRequest->gibdd_id = 0;
         if ($holeRequest->save()) {
             return true;
         }
         //else print_r($holeRequest->errors); die();
     } else {
         $this->errortext = $answer->failReason;
         //print_r($answer); die();
     }
     return false;
 }
开发者ID:ASDAFF,项目名称:RosYama.2,代码行数:30,代码来源:DorogiMosForm.php


示例13: filters

 /**
  * (non-PHPdoc)
  * @see yii/CController#filters()
  */
 public function filters()
 {
     return array_merge(array(
         array('SetupFilter'),
         array('SslFilter')
     ), parent::filters());
 }
开发者ID:hersoncruz,项目名称:ppma,代码行数:11,代码来源:Controller.php


示例14: actionRegistro

 public function actionRegistro()
 {
     $modelAlumnos = new Alumno();
     if (isset($_POST['Alumno'])) {
         try {
             $usuario = new Usuario();
             $usuario->perfil = 3;
             $usuario->nombreUsuario = $_POST['Alumno']['identificacion'];
             $usuario->password = md5($_POST['Alumno']['identificacion']);
             if ($usuario->save()) {
                 $alumno = new Alumno();
                 $alumno->attributes = $_POST['Alumno'];
                 $alumno->idUsuario = $usuario->idUsuario;
                 if (!$alumno->save()) {
                     Yii::app()->user->setFlash('alert alert-danger', "Alumno no fue creado");
                 } else {
                     Yii::app()->user->setFlash('alert alert-success', "Alumno  fue creado con éxito");
                     $this->redirect(CController::createUrl('/sitio/index'));
                 }
             } else {
                 Yii::app()->user->setFlash('alert alert-danger', "Alumno no fue creado");
             }
         } catch (Exception $e) {
             Yii::app()->user->setFlash('alert alert-danger', "Alumno no fue creado");
         }
     }
     $this->render('registroEstudiantes', array('modelAlumnos' => $modelAlumnos));
 }
开发者ID:jjaragon,项目名称:aplicacion,代码行数:28,代码来源:SitioController.php


示例15: beforeAction

 protected function beforeAction($action)
 {
     parent::beforeAction($action);
     if (Yii::app()->user->isGuest) {
         if (isset(Yii::app()->request->cookies['prefLang'])) {
             $sChosenLanguage = Yii::app()->request->cookies['prefLang']->value;
         } else {
             $sPrefferedLang = Yii::app()->request->getPreferredLanguage();
             if ($sPrefferedLang !== false && strpos($sPrefferedLang, "ru") !== false) {
                 $sChosenLanguage = "ru";
             } else {
                 $sChosenLanguage = "uk_ua";
             }
             $cookie = new CHttpCookie('prefLangId', $sChosenLanguage);
             $cookie->expire = time() + 86400 * 7;
             Yii::app()->request->cookies['prefLang'] = $cookie;
         }
     } else {
         $sChosenLanguage = Yii::app()->user->getLanguage();
     }
     switch ($sChosenLanguage) {
         case "ru":
             Yii::app()->language = "ru";
             break;
         default:
             Yii::app()->language = "uk_ua";
     }
     return true;
 }
开发者ID:snipesn,项目名称:UkrYama-2,代码行数:29,代码来源:Controller.php


示例16: __construct

 public function __construct($id, $module = null)
 {
     parent::__construct($id, $module);
     // If there is a post-request, redirect the application to the provided url of the selected language
     if (isset($_POST['language'])) {
         $lang = $_POST['language'];
         $MultilangReturnUrl = $_POST[$lang];
         $this->redirect($MultilangReturnUrl);
     }
     // Set the application language if provided by GET, session or cookie
     if (isset($_GET['language'])) {
         Yii::app()->language = $_GET['language'];
         Yii::app()->user->setState('language', $_GET['language']);
         $cookie = new CHttpCookie('language', $_GET['language']);
         $cookie->expire = time() + 60 * 60 * 24 * 365;
         // (1 year)
         Yii::app()->request->cookies['language'] = $cookie;
     } else {
         if (Yii::app()->user->hasState('language')) {
             Yii::app()->language = Yii::app()->user->getState('language');
         } else {
             if (isset(Yii::app()->request->cookies['language'])) {
                 Yii::app()->language = Yii::app()->request->cookies['language']->value;
             }
         }
     }
 }
开发者ID:basketbob,项目名称:timeman,代码行数:27,代码来源:Controller.php


示例17: init

 /**
  * initialize
  */
 function init()
 {
     parent::init();
     if (Yii::app()->getRequest()->getParam('printview')) {
         Yii::app()->layout = 'print';
     }
 }
开发者ID:rizaldi-github,项目名称:Yii-Playground,代码行数:10,代码来源:Controller.php


示例18: beforeAction

 protected function beforeAction($action)
 {
     if (Yii::app()->request->isAjaxRequest) {
         $this->layout = false;
     }
     return parent::beforeAction($action);
 }
开发者ID:apa-narola,项目名称:yiimoduledemo,代码行数:7,代码来源:Controller.php


示例19: afterAction

 protected function afterAction($action)
 {
     $time = sprintf('%0.5f', Yii::getLogger()->getExecutionTime());
     $memory = round(memory_get_peak_usage() / (1024 * 1024), 2) . "MB";
     echo '<!-- Time: ' . $time . 'ms, memory: ' . $memory . '-->';
     parent::afterAction($action);
 }
开发者ID:lp19851119,项目名称:114la,代码行数:7,代码来源:Controller.php


示例20: afterAction

 protected function afterAction($action)
 {
     parent::afterAction($action);
     if (!$this->readOnly) {
         Yii::app()->unitOfWork->commit();
     }
 }
开发者ID:njxjxj,项目名称:yorm,代码行数:7,代码来源:CUController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CCourse类代码示例发布时间:2022-05-23
下一篇:
PHP CContact类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap