本文整理汇总了PHP中Theme::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::model方法的具体用法?PHP Theme::model怎么用?PHP Theme::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme
的用法示例。
在下文中一共展示了Theme::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionLogin
/**
* 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));
}
示例2: getTheme
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;
}
示例3: actionActivateTheme
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));
}
示例4: convertExtraToArray
/**
* 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;
}
示例5: array
/* @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)));
示例6: array
<?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();
示例7: array
<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>
示例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 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;
}
示例9: htmlspecialchars
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">
示例10: array
<?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');
?>
示例11: actionTRelease
public function actionTRelease()
{
$this->layout = '//layouts/column1';
$theme = Theme::model()->findAll();
$this->render('trelease', array('themes' => $theme));
}
示例12: array
<?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');
示例13: getThemeOptions
/**
* 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');
}
示例14: array
<?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');
示例15: actionSync
/**
* 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'));
}
}