/** * Authenticates the password. * This is the 'authenticate' validator as declared in rules(). */ public function authenticate($attribute, $params) { if (!$this->hasErrors()) { $identity = new UserIdentity($this->username, $this->password); $identity->authenticate(); switch ($identity->errorCode) { case UserIdentity::ERROR_NONE: $duration = $this->rememberMe ? 2592000 : 0; Yii::app()->user->login($identity, $duration); break; case UserIdentity::ERROR_EMAIL_INVALID: $this->addError("username", F::t("Email is incorrect.")); break; case UserIdentity::ERROR_USERNAME_INVALID: $this->addError("username", F::t("Username is incorrect.")); break; case UserIdentity::ERROR_STATUS_NOTACTIV: $this->addError("status", F::t("You account is not activated.")); break; case UserIdentity::ERROR_STATUS_BAN: $this->addError("status", F::t("You account is blocked.")); break; case UserIdentity::ERROR_PASSWORD_INVALID: $this->addError("password", F::t("Password is incorrect.")); break; case UserIdentity::ERROR_STATUS_NOTADMIN: $this->addError("status", F::t("You account is not administrator.")); break; case UserIdentity::ERROR_STATUS_NOTOWNER: $this->addError("status", F::t("You account is not this store owner.")); break; } } }
function init() { parent::init(); $data = Menu::model()->findAll(array('order' => 'sort_order asc, menu_id asc')); $parent = CHtml::tag('option', array('value' => 0), F::t('Please Select')); $model = new Menu(); $this->parent = $parent . F::toTree($data, $model->menu_id, 'menu_id', 'parent_id', 'name', 1); }
function init() { parent::init(); //上一级 可支持无限级 分类 //上一级 可支持无限级 分类 $data = ContentCategory::model()->findAll(array('order' => 'sort_order asc, category_id asc')); $parent = CHtml::tag('option', array('value' => 0), F::t('Please Select')); $this->parent = $parent . F::toTree($data, $model->cate_id, 'category_id', 'parent_id', 'name', 1); }
function init() { parent::init(); //上一级 可支持无限级 分类 //上一级 可支持无限级 分类 $data = ItemProp::model()->findAll(array('order' => 'sort_order asc, prop_id asc')); $parent = CHtml::tag('option', array('value' => 0), F::t('Please Select')); $this->parent = $parent . F::toTree($data, $model->prop_id, 'prop_id', 'parent_prop_id', 'prop_name', 1); }
/** * 辅助生成树 * @param $arr * @param $selected * @param $value * @param $pid * @param $id * @param $name * @param $span * @return string */ public static function toTreeHelper($arr, $selected, $value, $pid, $id, $name, $span) { static $string; static $str; $array = array(); for ($i = 0; $i < $span; $i++) { $string .= ' '; } foreach ($arr as $rs) { if ($value == $rs->{$pid}) { if ($selected == $rs->{$id}) { $select = "selected='selected'"; } $str .= "<option value='" . $rs->{$id} . "' {$select}>" . $string . F::t($rs->{$name}) . "</option>"; if (self::toTreeHelper($arr, $selected, $rs->{$id}, $pid, $id, $name, $span)) { $str .= self::toTreeHelper($arr, $selected, $rs->{$id}, $pid, $id, $name, $span + 1); } } } return $str; }
echo F::date($f->create_time); ?> ): <?php echo CHtml::link($f->content, array('/feedback/view', 'id' => $f->id)); ?> <p><?php if ($f->reply) { ?> 管理员回复: <span style="color:#cd0a0a"><?php echo $f->reply; ?> </span><?php } ?> </p></li> </ul> <?php } ?> <h4><?php echo F::t('Create Feedback'); ?> </h4> <ul> <?php echo $this->renderPartial('_form', array('model' => $model)); ?> </ul> </div>
<?php $menu = Menu::model()->findByPk(4); $descendants = $menu->children()->findAll(); /* * 单级菜单 */ //foreach($descendants as $model){ //$items[] = array('label'=>strtoupper($model->name), 'url'=>$model->url ? Yii::app()->request->baseUrl.'/'.$model->url : '#'); //$items[] = array('label'=>'', 'url'=>'', 'itemOptions'=>array('class'=>'line7')); //} //$this->widget('zii.widgets.CMenu', array( // 'items'=>$items //)); /* * 多级菜单 */ foreach ($descendants as $model) { if ($model->getChildCount() > 0) { $items[] = array('label' => F::t($model->name), 'url' => $model->url ? Yii::app()->request->baseUrl . '/' . $model->url : '#', 'items' => $model->getChildMenu(), 'itemOptions' => array('class' => 'dropdown'), 'submenuOptions' => array('class' => 'dropdown')); } else { $items[] = array('label' => F::t($model->name), 'url' => $model->url ? Yii::app()->request->baseUrl . '/' . $model->url : '#'); } } //print_r($items); $this->widget('zii.widgets.CMenu', array('htmlOptions' => array('class' => 'horizontal unstyled clearfix'), 'items' => $items));
if (!Yii::app()->user->isGuest) { ?> <div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'comment-form', 'enableAjaxValidation' => true)); ?> <div class="row"> <?php echo $form->labelEx($model, 'content'); ?> <?php //echo $form->textArea($model,'content',array('rows'=>6, 'cols'=>50)); $this->widget('ext.jmarkitup.JHtmlEditor', array('model' => $model, 'attribute' => 'content', 'theme' => 'simple', 'htmlOptions' => array('rows' => 15, 'cols' => 50, 'style' => 'width:420px'), 'options' => array())); ?> <?php echo $form->error($model, 'content'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Submit' : 'Save'); ?> </div> <?php $this->endWidget(); ?> </div><!-- form --> <?php } else { echo F::t("Please {login} to leave your comment", 'Default', array('{login}' => CHtml::link(F::t('login'), array('/user/login/ajaxLogin'), array('class' => 'login')))); }
// canonical URLs should always be absolute ?> <script type="text/javascript"> $(function() { $(".add-comment").click(function(event) { $('#yw1').submit(); }); }); </script> <div class="page-title"> <h1><?php echo F::t($model->title); ?> </h1> </div> <div class="std"> <p><?php echo F::t('Post time:'); ?> <?php echo F::date($model->create_time); ?> </p> <p> <?php echo $model->content; ?> </p> <p align="center"><a href="javascript:history.go(-1);"><?php echo F::t('Back'); ?>
<?php $this->beginContent('//layouts/main'); ?> <div class="main-container col2-left-layout" style=""> <div class="main container show-bg" style=""> <?php if (isset($this->breadcrumbs)) { ?> <?php $this->widget('zii.widgets.CBreadcrumbs', array('links' => $this->breadcrumbs, 'htmlOptions' => array('class' => 'grid-full breadcrumbs'), 'separator' => NULL, 'tagName' => 'div', 'activeLinkTemplate' => '<li><a href="{url}">{label}</a><span>/ </span></li>', 'inactiveLinkTemplate' => '<li class="category"><strong>{label}</strong></li></ul>', 'homeLink' => '<ul><li class="home"><a href="' . Yii::app()->homeUrl . '">' . F::t('Home') . '</a><span>/ </span></li>')); ?> <!-- breadcrumbs --> <?php } ?> <div class="preface grid-full in-col1"></div> <div class="col-main grid12-9 grid-col2-main in-col2"> <?php echo $content; ?> </div> <div class="col-left sidebar grid12-3 grid-col2-sidebar in-sidebar" style=""> <div class="block block-vertnav " style=""> <?php $this->widget('widgets.ultimo.WCategory'); ?> </div> <div class="block block-layered-nav"> <div class="block-title"> <strong><span>Shop By</span></strong>
$cri = new CDbCriteria(array('condition' => 'category_id = ' . $h->id)); $helpChilds = Page::model()->findAll($cri); foreach ($helpChilds as $hc) { ?> <?php $activeclass = ""; if (!empty($hc->key) && stripos($cur_url, $hc->key) !== false) { $activeclass = "active"; } ?> <li class='f14 <?php echo $activeclass; ?> '> <?php echo CHtml::link(F::t($hc->title), array('/page/index', 'key' => $hc->key)); ?> </li> <?php } ?> </ul> </li> <li class='divers'> <p></p> </li> <?php } ?> </ul>
/** * @return array customized attribute labels (name=>label) */ public function attributeLabels() { return array('id' => 'Id', 'content' => F::t('Comment'), 'status' => 'Status', 'create_time' => 'Create Time', 'author' => 'Name', 'email' => 'Email', 'url' => 'Website', 'target_id' => 'Target'); }
//} //$this->widget('zii.widgets.CMenu', array( // 'items'=>$items //)); /* * 多级菜单 */ //foreach ($descendants as $model) { // // if ($model->getChildCount() > 0) { // $items[] = array('label' => F::t($model->name), 'url' => $model->url ? Yii::app()->request->baseUrl . '/' . $model->url : '#', // 'items' => $model->getChildMenu(), // 'itemOptions' => array('class' => 'dropdown'), 'submenuOptions' => array('class' => 'dropdown')); // } else { // $items[] = array('label' => F::t($model->name), 'url' => $model->url ? Yii::app()->request->baseUrl . '/' . $model->url : '#'); // } //} ////print_r($items); //$this->widget('zii.widgets.CMenu', array( // 'htmlOptions' => array('class' => 'nav'), // 'items' => $items //)); foreach ($descendants as $d) { ?> <div class="btn btn-large background-color-hover-1"> <?php echo CHtml::link(F::t($d->name), $d->url ? Yii::app()->request->baseUrl . '/' . $d->url : '#'); ?> </div> <?php }
public function getChildMenu() { $menu = Menu::model()->findByPk($this->id); $descendants = $menu->children()->findAll(); foreach ($descendants as $model) { $items[] = array('label' => F::t($model->name), 'url' => $model->url ? Yii::app()->request->baseUrl . '/' . $model->url : '#'); } return $items; }
<h2 class='title title-green'> <!-- 当前栏目样式 bg-green --> <a href="#"> <?php echo F::t($this->getMenuTitle()); ?> </a> </h2> <ul class='submenu'> <?php $cur_url = Yii::app()->request->getUrl(); $descendants = $this->getMenu(); foreach ($descendants as $model) { $activeclass = ""; $htmlOptions = array(); if (!empty($model->url) && stripos(strtolower($cur_url), strtolower($model->url)) != false) { $htmlOptions = array('class' => 'active'); $activeclass = "active"; } echo "<li class='f14 " . $activeclass . "'>"; echo CHtml::link(F::t($model->name), $model->url ? Yii::app()->request->baseUrl . '/' . $model->url : '#', $htmlOptions); echo '</li>'; } ?> </ul> </li> <li class='divers'> <p></p> </li> </ul>
echo CHtml::link(F::t("Lost Password?"), Yii::app()->getModule('user')->recoveryUrl); ?> </p> </div> <div class="checkbox"> <?php echo CHtml::activeCheckBox($model, 'rememberMe'); ?> <?php echo CHtml::activeLabelEx($model, 'rememberMe'); ?> </div> <?php echo CHtml::submitButton(F::t("Login"), array('class' => 'btn btn-lg btn-primary btn-block')); ?> <?php echo CHtml::endForm(); ?> </div><!-- form --> <?php $form = new CForm(array('elements' => array('username' => array('type' => 'text', 'maxlength' => 32), 'password' => array('type' => 'password', 'maxlength' => 32), 'rememberMe' => array('type' => 'checkbox')), 'buttons' => array('login' => array('type' => 'submit', 'label' => 'Login'))), $model); ?> </div> <!-- /container -->
<ul class="links"> <li class="first"><?php echo CHtml::link(F::t('Account'), array('/member'), array('title' => 'Account')); ?> </li> <li><?php echo CHtml::link(F::t('Wishlist'), array('/member/wishlist'), array('title' => 'Wishlist')); ?> </li> <li><?php echo CHtml::link(F::t('Log In'), array('/user/login'), array('title' => 'Log In')); ?> </li> <li class=" last" id="link-sign-up"><?php echo CHtml::link(F::t('Sign Up'), array('/user/registration'), array('title' => 'Sign Up')); ?> </li> </ul> </div> <!-- end: top-links --> </div> <!-- end: user-menu --> <!--</div>--> <!-- TODO:remove test!!!!!!!!!!! --> </div> <!-- end: header-main --> </div> <!-- end: grid unit --> </div> <!-- end: header -->
echo F::t('Tips:'); ?> </li> <li><?php echo F::t('After register you can:'); ?> </li> <li>1. <?php echo F::t('Save your personal information'); ?> </li> <li>2. <?php echo F::t('Collect the goods you concerned'); ?> </li> <li>3. <?php echo F::t('Enjoy the members points system'); ?> </li> <li>4. <?php echo F::t('Subscribe the goods information of our store'); ?> </li> <li class="btn"><?php echo CHtml::link(F::t('Register'), Yii::app()->getModule('user')->registrationUrl); ?> </li> </ul> </div> </div> </div>
} //$html .= CHtml::openTag('li',array('data-level'=>$descendant['level'],'class'=>'f14')); //$html .= CHtml::encode($descendant['label']); //$html .= CHtml::link(F::t($model['label']), $model['url'], $htmlOptions); if ($model['haschild']) { $html .= "<li>"; $html .= "<h2 class='title title-green'>"; $html .= "<a href='#' data-level=" . $model['level'] . ">" . F::t($model['label']) . "</a>"; $html .= "</h2>"; } else { $activeclass = ""; $htmlOptions = array(); if ($model['active']) { $htmlOptions = array('class' => 'active'); $activeclass = "active"; } $html .= "<li class='f14 " . $activeclass . "'>"; $html .= CHtml::link(F::t($model['label']), $model['url'], $htmlOptions); } $level = $model['level']; } } } for ($i = $level; $i; $i--) { $html .= CHtml::closeTag('li') . "\n"; $html .= CHtml::closeTag('ul') . "\n"; } echo $html; ?>
<?php $this->pageTitle = Yii::app()->name . ' - ' . ucfirst(F::t($key)); $this->breadcrumbs = array(ucfirst(F::t($key))); ?> <div class="page-title category-title"> <h1><?php echo ucfirst($key); ?> </h1> </div> <div class="horizontal-section"> <a href="http://ultimo.infortis-themes.com/demo/default/women.html#"> <!--<img src="<?php echo F::themeUrl(); ?> /media/category01.jpg" title="You can edit this block or replace it with custom content" alt="Sample banner">--> <?php echo CHtml::image(F::baseUrl() . '/../../upload/category/' . $model->pic, $key, array('title' => $key)); ?> <div class="caption light3 full-width"> <h2 class="heading permanent">Category Banner</h2> <p>Upload image and description for every category in the store</p> <p>Create landing pages for categories</p> </div> </a> </div>
<div class="block-title"> <strong><span><?php echo F::t('Categories'); ?> </span></strong> </div> <div class="block-content" style=""> <?php $categories = Category::model()->findByPk(3); $descendants = $categories->descendants()->findAll(); $level = 2; $k = 1; foreach ($descendants as $category) { if ($category->level == $level) { echo CHtml::closeTag('li') . "\n"; } else { if ($category->level > $level) { echo CHtml::openTag('ul', array('class' => 'level0')) . "\n"; } else { echo CHtml::closeTag('li') . "\n"; for ($i = $level - $category->level; $i; $i--) { echo CHtml::closeTag('ul') . "\n"; echo CHtml::closeTag('li') . "\n"; } } } echo CHtml::openTag('li', array('class' => 'level0 nav-' . $k . ' level-top')); echo CHtml::encode($category->name) . $category->getLabel(); $level = $category->level; }
<?php $this->pageTitle = Yii::app()->name . ' - ' . $page->title; $this->breadcrumbs = array(F::t('helpcenter') => array('/page/helpcenter'), $page->title); ?> <div class="page-title"> <h1><?php echo $page->title; ?> </h1> </div> <div class="std"> <?php echo $page->content; ?> </div>
} if (count($child_descendants) > 0) { echo "<h2 class='title title-green'>"; echo "<a href='#'>"; echo F::t($model->name); echo "</a>"; echo "</h2>"; echo "<ul class='submenu'>"; foreach ($child_descendants as $child_model) { $activeclass = ""; $htmlOptions = array(); if (!empty($child_model->url) && stripos($cur_url, $child_model->url) !== false) { $activeclass = "active"; } echo "<li class='f14 " . $activeclass . "'>"; echo " " . CHtml::link(F::t($child_model->name), $child_model->url ? Yii::app()->request->baseUrl . '/' . $child_model->url : '#', $htmlOptions); echo '</li>'; } echo "</ul>\t"; } } echo '</li>'; } ?> </ul> </li> <li class='divers'> <p></p> </li> </ul>
/media/03(1).png" alt="Create Magento sub-themes"> <h4 class="heading">Easy to customize</h4> <p>Use Ultimo as a starting point for your custom projects. Unlike many other themes, Ultimo lets you create multiple custom sub-themes (theme variants) for your clients.</p> <a href="http://ultimo.infortis-themes.com/demo/default/ultimo-responsive-magento-theme/" class="go">See all features</a> </div></div> </div> </li> <li class="level0 level-top right"> <a class="level-top" href="<?php echo Yii::app()->createUrl('/page/index', array('key' => 'about')); ?> " title="About Us"> <span><?php echo F::t('About Us'); ?> </span> </a> </li> </ul> <script type="text/javascript"> //<![CDATA[ jQuery(function($) { var activateMobileMenu = function() {
<?php $this->pageTitle = Yii::app()->name . ' - ' . F::t('News'); $this->breadcrumbs = array(F::t('News')); ?> <div class="page-title"> <h1><?php echo F::t('All News'); ?> </h1> </div> <div class="std"> <ul class="bullet"> <?php foreach ($lists as $n) { ?> <li><span style="float:right;"><?php echo F::date($n->create_time, 'medium', NULL); ?> </span><?php echo CHtml::link($n->title, $n->getUrl()); ?> </li> <?php } ?> </ul> </div>