/** * Displays the login page */ public function actionLogin() { $model = new LoginForm(); // if it is ajax validation request /* if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } */ // collect user input data if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if ($model->validate() && $model->login()) { /* Simpan theme ke cookies */ $user = User::model()->findByPk(Yii::app()->user->id); $theme = Theme::model()->findByPk($user->theme_id); $theme->toCookies(); $this->redirect(Yii::app()->user->returnUrl); } } // display the login form $this->render('login', array('model' => $model)); }
public function getTheme() { if (!isset(Yii::app()->user->id)) { $themeId = Theme::model()->getCookies(); if (is_null($themeId)) { return NULL; } $theme = Theme::model()->findByPk($themeId); } else { $user = User::model()->findByPk(Yii::app()->user->id); // if (is_null($user->theme_id)) { // $theme= NULL; // } else { $theme = Theme::model()->findByPk($user->theme_id); // } } return is_null($theme) ? NULL : $theme->nama; }
public function actionActivateTheme() { $themes = Theme::model()->findAll(); $suc = Yii::t('info', 'Theme has been Activated'); $err = Yii::t('info', 'Theme was not Activated'); if (isset($_POST['Theme']['name'])) { $valid = Theme::model()->findByAttributes(array('name' => $_POST['Theme']['name'])); if (!empty($valid)) { file_put_contents(UtilityHelper::yiiparam('frontPath') . "/config/main-theme.php", $this->getConfigTemplate($_POST['Theme']['name'])); Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, $suc); } else { Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, $err); } } else { //Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR,$err); } $this->render('activate', array('models' => $themes)); }
/** * Convert extra data to an array of key=>value pairs */ protected function convertExtraToArray($string) { if (!$string) { return array(); } $_temp = array(); if ($string == '#show_roles#') { $roles = Yii::app()->authManager->getAuthItems(); $items = array(CAuthItem::TYPE_ROLE => array(), CAuthItem::TYPE_TASK => array(), CAuthItem::TYPE_OPERATION => array()); $itemTitles = array(CAuthItem::TYPE_ROLE => at('Roles'), CAuthItem::TYPE_TASK => at('Tasks'), CAuthItem::TYPE_OPERATION => at('Operations')); if (count($roles)) { foreach ($roles as $item) { $_temp[$itemTitles[$item->type]][$item->name] = $item->name; } } } else { if ($string == '#show_timezones#') { $_temp = getTimeZones(); } elseif ($string == '#show_themes#') { $_temp = Theme::model()->getThemesByDirname(); } else { if ($string == '#show_languages#') { $_temp = Language::model()->getLanguagesCodes(); } else { if ($string == '#show_cache_options#') { $cacheOptions = getSupprotedCacheOptions(); foreach ($cacheOptions as $cacheKey => $cacheOption) { if ($cacheOption['visible']) { $_temp[$cacheKey] = $cacheOption['title']; } } } else { $exploded = explode("\n", $string); if (count($exploded)) { foreach ($exploded as $explode) { if (!trim($explode)) { continue; } // Make sure we have = in the line if (strpos($explode, '=') === false) { continue; } list($key, $value) = explode('=', trim($explode)); $_temp[$key] = $value; } } } } } } return $_temp; }
/* @var $this ScreenController */ /* @var $model Screen */ $this->breadcrumbs = array(Yii::t('screen', 'Screens') => array('index'), $model->name); $this->menu = array(array('label' => Yii::t('screen', 'List Screen'), 'url' => array('index')), array('label' => Yii::t('screen', 'Create Screen'), 'url' => array('create'), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('screen', 'Update Screen'), 'url' => array('update', 'id' => $model->id), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('screen', 'Delete Screen'), 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => Yii::t('default', 'Are you sure you want to delete this item?')), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('screen', 'Manage Screen'), 'url' => array('admin'), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('ad', 'Create Ad'), 'url' => array('Ad/Create', 'screen_id' => $model->id))); ?> <h1> <?php echo Yii::t('screen', 'View Screen') . ' #' . $model->id; $admin = Yii::app()->user->checkAccess('Administrator'); if ($admin) { $this->widget('booster.widgets.TbButton', array('label' => Yii::t('screen', 'Display Screen'), 'id' => 'openDisplay', 'context' => 'primary', 'htmlOptions' => array('onclick' => 'js:window.open("' . Yii::app()->createUrl('display/' . $model->id) . '")', 'style' => 'float:left; margin-right:2px;'))); } $this->widget('booster.widgets.TbButton', array('context' => 'success', 'htmlOptions' => array('style' => 'float:left;'), 'tooltip' => true, 'tooltipOptions' => array('placement' => 'top', 'title' => Yii::t('screen', 'Update Messages in the display'), 'delay' => array('show' => 400, 'hide' => 500)), 'id' => 'screenRefresh', 'label' => Yii::t('screen', 'Refresh'), 'buttonType' => 'ajaxSubmit', 'url' => Yii::app()->createUrl('Ajax/screenRefresh'), 'ajaxOptions' => array('type' => 'POST', 'data' => array('screen_id' => $model->id), 'success' => 'function(data) { $("#screenRefresh").prop("disabled", true); }'))); ?> </h1> <?php $this->widget('booster.widgets.TbDetailView', array('type' => 'striped', 'data' => $model, 'attributes' => array('name', 'description', array('label' => Weather::model()->getAttributeLabel('Weather Area'), 'value' => empty($model->weatherCodes) ? null : $model->weatherCodes[0]->name_heb, 'visible' => $admin), array('label' => Theme::model()->getAttributeLabel('theme'), 'value' => empty($model->themes) ? null : $model->themes[0]->theme, 'visible' => $admin), array('label' => Commercial::model()->getAttributeLabel('id'), 'value' => empty($model->commercials) ? null : $model->commercials[0]->name, 'visible' => $admin), array('name' => 'monitor.name', 'visible' => $admin), array('name' => 'dongle.name', 'visible' => $admin), array('name' => 'yeshuv.name_heb', 'visible' => $admin), array('name' => 'url', 'visible' => $admin), array('name' => 'webkey_nickname', 'type' => 'raw', 'value' => CHtml::link($model->getAttribute('webkey_nickname'), 'http://webkey.cc/' . $model->getAttribute('webkey_nickname'), array('target' => '_blank')), 'visible' => $admin)))); ?> <br> <h1><?php echo Yii::t('screen', 'Screen Ads'); ?> </h1> <div class="clear"></div> <?php $this->widget('booster.widgets.TbListView', array('dataProvider' => $adDataProvider, 'itemView' => '/ad/_view', 'viewData' => array('screen_id' => $model->id)));
<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'ad-form', 'htmlOptions' => array('enctype' => 'multipart/form-data'), 'enableAjaxValidation' => false)); ?> <p class="help-block">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); echo $form->textFieldControlGroup($model, 'title', array('class' => 'span5')); echo $form->fileFieldControlGroup($model, 'pic', array('class' => 'span5')); echo $form->textFieldControlGroup($model, 'url', array('class' => 'span5')); $data = Theme::model()->findAll(); $list = CHtml::listData($data, 'theme', 'name'); echo $form->dropDownListControlGroup($model, 'theme', $list); echo $form->textAreaControlGroup($model, 'content', array('class' => 'span8', 'rows' => 5)); echo $form->textFieldControlGroup($model, 'sort_order'); ?> <?php echo TbHtml::formActions(array(TbHtml::submitButton('Submit', array('color' => TbHtml::BUTTON_COLOR_PRIMARY)), TbHtml::resetButton('Reset'))); ?> <?php $this->endWidget();
<div class="small-12 columns"> <?php echo $form->labelEx($model, 'newPassword'); ?> <?php echo $form->passwordField($model, 'newPassword', array('size' => 60, 'maxlength' => 512)); ?> <?php echo $form->error($model, 'newPassword', array('class' => 'error')); ?> </div> </div> <div class="row"> <div class="small-12 columns"> <?php echo $form->labelEx($model, 'newPasswordRepeat'); ?> <?php echo $form->passwordField($model, 'newPasswordRepeat', array('size' => 60, 'maxlength' => 512)); ?> <?php echo $form->error($model, 'newPasswordRepeat', array('class' => 'error')); ?> </div> </div> <div class="row"> <div class="small-12 columns"> <?php echo $form->labelEx($model, 'theme_id'); ?> <?php echo $form->dropDownList($model, 'theme_id', Theme::model()->listTheme()); ?> <?php echo $form->error($model, 'theme_id', array('class' => 'error')); ?> </div> </div> <div class="row"> <div class="small-12 columns"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Tambah' : 'Simpan', array('class' => 'tiny bigfont button')); ?> </div> </div> <?php $this->endWidget(); ?> </div>
/** * 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 = Theme::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
CSS; $jscode = <<<JS JS; $htmlcode = $model->isNewRecord ? $htmlcode : htmlspecialchars($model->html); $csscode = $model->isNewRecord ? $csscode : htmlspecialchars($model->css); $jscode = $model->isNewRecord ? $jscode : htmlspecialchars($model->javascript); ?> <section id="codeeditorBox"> <a name="top"></a> <div id="codeeditorPop" style="background: blue;" class="popbutton" onclick="uu.popLayoutAlone($('#codeeditorBox'),$(this));">弹起</div> <div id="control"> <ul class="right input"> <li>主题截图:<a href="#iframe"><span onclick="getScreenShot();" style="width:22px;height:16px;background:blue;display:inline-block;cursor:pointer;"> </span></a></li> <li>风格:<?php echo CHtml::dropDownList('Theme_style', $model->style, Theme::model()->generateStyleList()); ?> </li> <li>费用:<input type="text" id="Theme_charge" style="width: 60px;" value="<?php echo $model->charge; ?> " />元</li> <li><input type="button" value="提交" onclick="submitTheme();" /></li> </ul> <ul class="left input"> <li>名称:<input type="text" id="Theme_name" style="width: 150px;" value="<?php echo $model->name; ?> " /></li> </ul> <ul id="panels">
<?php echo $form->labelEx($model, 'name'); ?> <?php echo $form->textField($model, 'name', array('size' => 16, 'maxlength' => 24)); ?> <?php echo $form->error($model, 'name'); ?> </div> <div class="row span-4"> <?php echo $form->labelEx($model, 'style'); ?> <?php echo $form->dropDownList($model, 'style', Theme::model()->generateStyleList()); ?> <?php echo $form->error($model, 'style'); ?> </div> <div class="row span-4"> <?php echo $form->labelEx($model, 'charge'); ?> <?php echo $form->textField($model, 'charge', array('size' => 16)); ?> <?php echo $form->error($model, 'charge'); ?>
public function actionTRelease() { $this->layout = '//layouts/column1'; $theme = Theme::model()->findAll(); $this->render('trelease', array('themes' => $theme)); }
<?php $pageName = 'home'; $pageData = array(); $headData = GlobalCMS::$setting; $pageData['content_top'] = Render::content_top($pageName); $pageData['content_left'] = Render::content_left($pageName); $pageData['content_right'] = Render::content_right($pageName); $pageData['content_bottom'] = Render::content_bottom($pageName); Theme::model('home'); $curPage = 0; if ($matches = Uri::match('page\\/(\\d+)')) { $curPage = $matches[1]; } $pageData['newPost'] = Post::get(array('limitPage' => $curPage, 'limitShow' => 10, 'orderby' => 'order by date_added desc')); $pageData['listPage'] = listPage(); // print_r(GlobalCMS::$setting);die(); Theme::view('head', $headData); Theme::view($pageName, $pageData); Theme::view('footer');
/** * Returns an array of all the themes created. * @return the themes thatb were created */ public static function getThemeOptions() { return CHtml::listData(Theme::model()->findAll(array('order' => 'theme')), 'id', 'theme'); }
<?php $pageName = 'contactus'; $pageData = array(); $headData = GlobalCMS::$setting; $pageData['content_top'] = Render::content_top($pageName); $pageData['content_left'] = Render::content_left($pageName); $pageData['content_right'] = Render::content_right($pageName); $pageData['content_bottom'] = Render::content_bottom($pageName); Theme::model('contactus'); // print_r(GlobalCMS::$setting);die(); $pageData['alert'] = ''; if (Request::has('btnSend')) { $pageData['alert'] = contactProcess(); } Theme::view('head', $headData); Theme::view($pageName, $pageData); Theme::view('footer');
/** * Sync theme */ public function actionSync($id) { // Check Access checkAccessThrowException('op_theme_sync'); if ($model = Theme::model()->findByPk($id)) { $total = $model->SyncTheme(); alog(at("Synced Theme '{name}'.", array('{name}' => $model->name))); fok(at('Theme Synced. Total {n} files synced.', array('{n}' => $total))); $this->redirect(array('themes/index')); } else { $this->redirect(array('themes/index')); } }
<?php if (!($match = Uri::match('category-(\\d+)\\/?'))) { Redirect::to('404page'); // Alert::make('Page not found'); } $pageName = 'category'; $pageData = array(); $pageData['content_top'] = Render::content_top($pageName); $pageData['content_left'] = Render::content_left($pageName); $pageData['content_right'] = Render::content_right($pageName); $pageData['content_bottom'] = Render::content_bottom($pageName); Theme::model('category'); $headData = GlobalCMS::$setting; $pageData['newPost'] = searchResult($match[1]); $pageData['listPage'] = listPage(); Theme::view('head', $headData); Theme::view($pageName, $pageData); Theme::view('footer');
/** * Sync all themes * */ public function syncAllThemes() { $rows = Theme::model()->findAll(); foreach ($rows as $row) { $row->syncTheme(); } return true; }
public function afterSave() { $theme = Theme::model()->findByPk($this->theme_id); $theme->toCookies(); return parent::afterSave(); }
<?php if (!isset($_RESQUEST['id'])) { if (!($match = Uri::match('^post\\-(\\d+)\\-.*?\\.html'))) { Redirect::to('404page'); } $_RESQUEST['id'] = $match[1]; $id = $match[1]; } else { $id = $_RESQUEST['id']; } // print_r($_RESQUEST['id']);die(); $pageName = 'post'; $pageData = array(); $pageData['content_top'] = Render::content_top($pageName); $pageData['content_left'] = Render::content_left($pageName); $pageData['content_right'] = Render::content_right($pageName); $pageData['content_bottom'] = Render::content_bottom($pageName); Theme::model('post'); $headData = GlobalCMS::$setting; $pageData['commentAlert'] = sendComment(); // $pageData['categories']=categories(); $pageData = postProcess($pageData); $pageData['listComments'] = listComments($id); $headData['title'] = $pageData['title']; Theme::view('head', $headData); Theme::view($pageName, $pageData); Theme::view('footer');
<?php if ((int) GlobalCMS::$setting['enable_rss'] == 0) { Alert::make('Page not found'); } $pageName = 'rss'; $pageData = array(); $headData = GlobalCMS::$setting; Theme::model('rss'); $pageData['listPost'] = listRss(); $pageData['setting'] = $headData; Theme::view($pageName, $pageData);
<?php $pageName = 'home'; $pageData = array(); $pageData['content_top'] = Render::content_top($pageName); $pageData['content_left'] = Render::content_left($pageName); $pageData['content_right'] = Render::content_right($pageName); $pageData['content_bottom'] = Render::content_bottom($pageName); Theme::model('search'); $headData = GlobalCMS::$setting; // $pageData['categories']=categories(); $keyword = ''; $pageData['newPost'] = searchResult(); $parseData = listPage(); $pageData['listPage'] = $parseData['pages']; $pageData['keywords'] = $parseData['keywords']; Theme::view('head', $headData); Theme::view('search', $pageData); Theme::view('footer');
<?php if (!Uri::has('^page\\-\\d+\\-.*?\\.html')) { Redirect::to('404page'); } $pageName = 'page'; $pageData = array(); $pageData['content_top'] = Render::content_top($pageName); $pageData['content_left'] = Render::content_left($pageName); $pageData['content_right'] = Render::content_right($pageName); $pageData['content_bottom'] = Render::content_bottom($pageName); $headData = GlobalCMS::$setting; Theme::model('page'); $pageData['alert'] = ''; $pageData = pageProcess($pageData); if (isset($pageData['keywords'])) { $headData['keywords'] = $pageData['keywords']; } $headData['title'] = $pageData['title']; if ($pageData['page_type'] == 'fullwidth') { $pageName = 'pageFullWidth'; } Theme::view('head', $headData); Theme::view($pageName, $pageData); Theme::view('footer');