本文整理汇总了PHP中CController::init方法的典型用法代码示例。如果您正苦于以下问题:PHP CController::init方法的具体用法?PHP CController::init怎么用?PHP CController::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CController
的用法示例。
在下文中一共展示了CController::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$uri = Yii::app()->request->requestUri;
if (strpos($uri, 'favicon') !== false || strpos($uri, 'robots') !== false) {
Yii::app()->end();
}
parent::init();
$this->view = Yii::app()->getViewRenderer();
$reqUri = Yii::app()->getRequest()->getRequestUri();
if (strpos($reqUri, '?') !== false) {
$reqUri = substr($reqUri, 0, strpos($reqUri, '?'));
}
$this->view->currentURI = $reqUri;
$this->view->currentCaption = $this->getCurrentCaption($reqUri);
$fscname = null;
//
if (Yii::app()->user->getId() !== null) {
$fscname = Yii::app()->user->fscname;
$this->view->sitemedia = array('uri' => Yii::app()->params['mediauri'], 'jssuffix' => Yii::app()->params['mediasuffix']);
}
if ($fscname) {
$this->view->userinfo = array('fscname' => $fscname);
$this->renderMenu();
}
}
示例2: init
public function init()
{
$this->baseUrl = Y::config('baseUrl');
Yii::app()->language = isset($_GET['lang']) ? $_GET['lang'] : "ru";
parent::init();
}
示例3: init
public function init()
{
if (Yii::app()->user->isGuest) {
$this->redirect(Yii::app()->createUrl('auth/login'));
}
return parent::init();
}
示例4: init
public function init()
{
parent::init();
if (!Ibos::app()->user->isGuest && Ibos::app()->user->isNeedReset && !Ibos::app()->request->isAjaxRequest) {
Ibos::app()->request->redirect(Ibos::app()->createUrl("user/default/reset"));
}
}
示例5: init
public function init()
{
if (Yii::app()->user->id) {
Yii::app()->theme = Yii::app()->user->theme;
}
parent::init();
}
示例6: init
public function init()
{
// enable the KCFINDER uploads
$KCFINDER = array('disabled' => false, 'uploadURL' => Yii::app()->baseUrl . "/uploads/", 'uploadDir' => Yii::app()->basePath . "/../uploads/");
Yii::app()->session['KCFINDER'] = $KCFINDER;
parent::init();
}
示例7: init
/**
* @inheritDoc
*/
public function init()
{
parent::init();
if ($this->layout === null) {
$this->layout = $this->module->defaultLayout;
}
}
示例8: init
public function init()
{
if ($layout = $this->getModule()->adminLayout) {
$this->layout = $layout;
}
parent::init();
}
示例9: init
public function init()
{
parent::init();
Yii::import('ext.ThemePicker.EThemePicker');
EThemePicker::setTheme();
Yii::app()->params['title'] = Yii::app()->name;
$controller = Yii::app()->controller;
if (!file_exists('install_lock.txt')) {
if (!$controller instanceof InstallController) {
$this->redirect('install/install');
}
}
if (isset($_GET['lang']) && $_GET['lang'] != "") {
//當點擊轉換語言時
Yii::app()->user->setState("language", $_GET['lang']);
//相當於與設置一個cookie
Yii::app()->language = Yii::app()->user->getState("language");
//轉換成相應的記錄語言
}
if (Yii::app()->user->getState("language")) {
//如果設置了有session記錄
Yii::app()->language = Yii::app()->user->getState("language");
//轉換成相應的記錄語言
} else {
Yii::app()->user->setState("language", "en_us");
//沒有session則設置一個session.默認語言為en_us
Yii::app()->language = Yii::app()->user->getState("language");
//轉換成相應的記錄語言
}
}
示例10: init
public function init()
{
parent::init();
if (empty($this->modelName)) {
throw new CException("You should set modelName before using JsonApiController.");
}
}
示例11: init
function init()
{
// MFM CController
parent::init();
$app = Yii::app();
if (isset($_POST['_lang'])) {
$app->language = $_POST['_lang'];
$app->session['_lang'] = $app->language;
} else {
if (isset($app->session['_lang'])) {
$app->language = $app->session['_lang'];
}
}
//-----------------------------
if (!Yii::app()->user->isGuest) {
$identity = new UserIdentity(Yii::app()->user->username, Yii::app()->user->password);
$identity->authenticate(false);
if ($identity->errorCode != ERROR_NONE) {
Yii::app()->user->logout();
Yii::app()->user->setState('status', User::STATUS_GUEST);
$this->redirect(Yii::app()->homeUrl);
}
} else {
Yii::app()->user->setState('status', User::STATUS_GUEST);
}
}
示例12: init
public function init()
{
if ($this->_mustHaveRec && !isset($this->actionParams['rec'])) {
throw new CHttpException(403);
}
parent::init();
}
示例13: init
/**
* Инициализация контроллера
*/
public function init($action)
{
parent::init();
$this->uid = get_uid(false);
$this->is_adm = hasPermissions('projects', $this->uid);
$this->layout = '//layouts/content-with-right-narrow-sidebar';
}
示例14: init
function init()
{
parent::init();
ClassSession::savedSessionId();
/// just to be SURE it is set
Yii::app()->setTimeZone(Yii::app()->params['timezone']);
}
示例15: init
public function init()
{
parent::init();
if (Yii::app()->request->getIsAjaxRequest()) {
$this->layout = '//layouts/clear';
}
}