Example #1
0
 public function init()
 {
     $controllerID = trim(Yii::app()->controller->id);
     $actionID = trim(Yii::app()->controller->action->id);
     $controlerId = strtolower(trim($controlerId));
     $actionID = strtolower(trim($actionID));
     if ($controllerID == "order" || $controllerID == 'myaddress') {
         $this->menuId = F::sg('menu', 'dealerOrderMenu');
     } else {
         if ($controllerID == "sell") {
             $this->menuId = F::sg('menu', 'dealerSellMenu');
             //销售管理
         } else {
             if ($controllerID == "makequery") {
                 $this->menuId = F::sg('menu', 'dealermakequeryMenu');
                 //商家查询
             } else {
                 if (in_array($controllerID, array('marketing', 'business'))) {
                     if ($controllerID == "business" && $actionID == "index") {
                         $this->menuId = F::sg('menu', 'dealerSidebarMenu');
                         //我的公司
                     } else {
                         $this->menuId = F::sg('menu', 'dealermarketingMenu');
                         //营销管理
                     }
                 } else {
                     $this->menuId = F::sg('menu', 'dealerSidebarMenu');
                 }
             }
         }
     }
 }
Example #2
0
 public function init()
 {
     $user = Yii::app()->user;
     $controlerId = Yii::app()->getController()->id;
     $controlerId = strtolower(trim($controlerId));
     echo $user;
     if ($controlerId == 'partner') {
         $this->menuId = F::sg('menu', 'partnerSiderMenu');
     }
 }
Example #3
0
 public function init()
 {
     $controlerId = Yii::app()->getController()->id;
     $controlerId = strtolower(trim($controlerId));
     if ($controlerId == 'servicemain' || $controlerId == 'servicebusiness') {
         $this->menuId = F::sg('menu', 'servicerSiderbarMenu');
     } elseif ($controlerId == 'servicemarket' || $controlerId == 'servicepromotions') {
         $this->menuId = F::sg('menu', 'servicerMarketSiderbarMenu');
     }
 }
Example #4
0
 public function init()
 {
     $identity = Yii::app()->user->identity;
     if ($identity == 1) {
         $this->menuId = F::sg('menu', 'makermemberSiderbarMenu');
     } elseif ($identity == 2) {
         $this->menuId = F::sg('menu', 'dealermemberSiderbarMenu');
     } else {
         $this->menuId = F::sg('menu', 'servicememberSiderbarMenu');
     }
 }
Example #5
0
 public function getMainMenu()
 {
     $descendants = array();
     $mainMenu = F::sg('menu', 'autodataMenu');
     if (empty($mainMenu)) {
         return $descendants;
     }
     $main = Menu::model()->findByPk($mainMenu);
     if ($main) {
         $descendants = $main->children()->findAll();
     }
     return $descendants;
 }
Example #6
0
 public function getHelp()
 {
     $help = array();
     $menuID = F::sg('menu', 'helpSiderbarMenu');
     if (empty($menuID)) {
         return $help;
     }
     $category = Category::model()->findByPk($menuID);
     if ($category != null) {
         $help = $category->children()->findAll("if_show=:if_show", array(":if_show" => 1));
     }
     return $help;
 }
Example #7
0
 public function init()
 {
     $controlerId = Yii::app()->getController()->id;
     $controlerId = strtolower(trim($controlerId));
     if ($controlerId == 'makecompany') {
         $this->menuId = F::sg('menu', 'makeCompanySiderMenu');
     } elseif ($controlerId == 'makeorder') {
         $this->menuId = F::sg('menu', 'makeOrderSiderMenu');
     } elseif ($controlerId == 'default') {
         $this->menuId = F::sg('menu', 'makeSearchSiderMenu');
     } elseif (in_array($controlerId, array('salesmanage', 'goodscategory', 'templatemanage'))) {
         $this->menuId = F::sg('menu', 'makeGoodsSiderMenu');
     } else {
         $this->menuId = F::sg('menu', 'makeSiderMenu');
     }
 }
Example #8
0
 public function init()
 {
     $user = Yii::app()->user;
     $controlerId = Yii::app()->getController()->id;
     $controlerId = strtolower(trim($controlerId));
     if ($controlerId == 'quotationsell') {
         $this->menuId = F::sg('menu', 'mallQuotationSellSiderbarMenu');
     } elseif ($controlerId == 'quotationbuy') {
         if ($user->isDealer()) {
             $this->menuId = F::sg('menu', 'dealerOrderMenu');
         } else {
             if ($user->isServicer()) {
                 $this->menuId = F::sg('menu', 'mallQuotationBuySiderbarMenu');
             }
         }
     }
 }
Example #9
0
 public function getMainMenu()
 {
     $mainMenu = F::sg('menu', 'defaultMainMenu');
     $user = Yii::app()->user;
     if ($user->isMaker()) {
         $mainMenu = F::sg('menu', 'makerMainMenu');
     } else {
         if ($user->isDealer()) {
             $mainMenu = F::sg('menu', 'dealerMainMenu');
         } else {
             if ($user->isServicer()) {
                 $mainMenu = F::sg('menu', 'servicerMainMenu');
             }
         }
     }
     $main = Menu::model()->findByPk($mainMenu);
     $descendants = array();
     if ($main) {
         $descendants = $main->children()->findAll("if_show=:if_show", array(":if_show" => 1));
     }
     return $descendants;
 }
Example #10
0
 public function init()
 {
     parent::init();
     $host = Yii::app()->request->hostInfo;
     $domain = str_replace('http://', '', $host);
     if ($host == 'http://' . F::sg('site', 'shopDomain')) {
         Yii::app()->theme = 'store';
     } else {
         $store = Store::model()->findByAttributes(array('domain' => $domain));
         $session = new CHttpSession();
         $session->open();
         //	    $session->destroy();
         $session['store'] = array('store_id' => $store->store_id, 'name' => $store->name, 'email' => $store->email, 'theme' => $store->theme);
         //	    $store_name = $session['store'];  // get session variable 'name1'
         //	    foreach ($session as $name => $value) // traverse all session variables
         //		$session['name3'] = $value3;  // set session variable 'name3'
         //	    echo $store->domain;
         //	    exit;
         Yii::app()->theme = $store->theme;
         //	    print_r($_SESSION);
     }
     //	    exit;
 }
Example #11
0
 public static function call($service, $params = array())
 {
     // 缓存时间,大于0时才缓存
     $queryCachingDuration = F::sg('cache', 'jpdataCachingDuration');
     if ($queryCachingDuration > 0 && self::isCacheService($service)) {
         $cache = Yii::app()->cache;
         $cache_key = self::createCacheKey($service, $params);
         $cache_value = $cache->get($cache_key);
         if ($cache_value) {
             return $cache_value;
         }
     }
     //依据service调用不同的方法
     $result = APIServer::executeService($service, $params);
     // 设置缓存
     if ($queryCachingDuration > 0 && !empty($result)) {
         $cache = Yii::app()->cache;
         $cache->set($cache_key, $result);
     }
     if (is_null($result)) {
         $result = array();
     }
     return $result;
 }
Example #12
0
 /**
  * get item image gallery
  * @return array
  * @author milkyway(yhxxlm@gmail.com)
  */
 public function getItemGallery()
 {
     $images = ItemImg::model()->findAllByAttributes(array('item_id' => $this->item_id));
     foreach ($images as $k => $v) {
         $imageList[] = 'http://' . F::sg('site', 'imageDomain') . '/store/' . $v->store_id . '/item/image/' . $v['url'];
     }
     return $imageList;
 }
Example #13
0
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]-->
<head>
    <title><?php 
echo F::sg('seo', 'mainTitle');
?>
</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <!--meta info-->
    <meta name="author" content="Yincart Team">
    <meta name="keywords" content="<?php 
echo F::sg('seo', 'mainKwrds');
?>
">
    <meta name="description" content="<?php 
echo F::sg('seo', 'mainDescr');
?>
">
    <link rel="icon" type="image/ico" href="<?php 
echo F::themeUrl();
?>
/images/fav.ico">
    <!--stylesheet include-->
    <link rel="stylesheet" type="text/css" media="all" href="<?php 
echo F::themeUrl();
?>
/css/colorpicker.css">
    <link rel="stylesheet" type="text/css" media="all" href="<?php 
echo F::themeUrl();
?>
/css/flexslider.css">
Example #14
0
 public function init()
 {
     if ($this->is_init) {
         return;
     }
     $mainMenu = F::sg('menu', 'defaultMainMenu');
     $user = Yii::app()->user;
     if ($user->isMaker()) {
         $mainMenu = F::sg('menu', 'makerMainMenu');
     } else {
         if ($user->isDealer()) {
             $mainMenu = F::sg('menu', 'dealerMainMenu');
         } else {
             if ($user->isServicer()) {
                 $mainMenu = F::sg('menu', 'servicerMainMenu');
             }
         }
     }
     $main = Menu::model()->findByPk($mainMenu);
     $descendants = array();
     if ($main) {
         //$descendants = $main->children()->findAll("if_show=:if_show",array(":if_show"=>1));
         $descendants = $main->descendants()->findAll("if_show=:if_show", array(":if_show" => 1));
         $level = $main->level + 1;
     }
     $route = Yii::app()->getController()->getRoute();
     $activeMainItem = 0;
     $activeRouteMainItem = 0;
     $firstMainItem = 0;
     $currentMainItem = 0;
     $mainMenu = array();
     $activeSidebarItem = 0;
     $sidebarMenu = array();
     $findActive = false;
     $preLevel = 0;
     $preItem = 0;
     $active = array();
     foreach ($descendants as $n => $descendant) {
         $menu = array('label' => $descendant->name, 'url' => $descendant->url ? Yii::app()->request->baseUrl . '/' . $descendant->url : '#', 'active' => false, 'level' => $descendant->level, 'haschild' => false);
         // 查找主菜单
         if ($descendant->level == $level) {
             $currentMainItem = $descendant->id;
             // 如果子菜单URL属性与当前路径对应,表示找到当前活动子菜单,则当前的主菜单为活动主菜单
             if (!$findActive) {
                 $activeMainItem = $descendant->id;
                 // 每次变换主菜单,子菜单重新初始化
                 $sidebarMenu = array();
                 // 将主菜单加入到子菜单的第一项
                 $sidebarMenu[$descendant->id] = $menu;
                 $sidebarMenu[$descendant->id]['haschild'] = true;
             }
             // 如果子菜单URL属性与当前路径对应,表示找到当前活动子菜单
             if (!$findActive && $this->isItemActive($descendant, $route)) {
                 $activeRouteMainItem = $descendant->id;
             }
             if ($firstMainItem == 0) {
                 $firstMainItem = $descendant->id;
             }
             // 写主菜单组
             $mainMenu[$descendant->id] = $menu;
         } else {
             if ($currentMainItem == $activeMainItem && $descendant->level > $level) {
                 // 如果子菜单URL属性与当前路径对应,表示找到当前活动子菜单
                 if (!$findActive && $this->isItemActive($descendant, $route)) {
                     $activeSidebarItem = $descendant->id;
                     //$menu['active'] = true;
                     $findActive = true;
                 }
                 // 子菜单如果有多级,则父级子菜单需要标注为父菜单,切删除最父主菜单
                 if ($descendant->level > $preLevel && $preLevel != 0) {
                     $sidebarMenu[$preItem]['haschild'] = true;
                     unset($sidebarMenu[$currentMainItem]);
                 }
                 // 写子菜单组
                 $sidebarMenu[$descendant->id] = $menu;
                 $preLevel = $descendant->level;
                 $preItem = $descendant->id;
             }
         }
     }
     if (!$findActive) {
         if ($activeRouteMainItem > 0) {
             $activeMainItem = $activeRouteMainItem;
         } else {
             $activeMainItem = $firstMainItem;
         }
         $sidebarMenu = array();
     }
     $mainMenu[$activeMainItem]['active'] = true;
     if ($findActive) {
         $sidebarMenu[$activeSidebarItem]['active'] = true;
     }
     $active['sidebarMenu'] = $activeSidebarItem;
     $active['mainMenu'] = $activeMainItem;
     $this->activeMenu = $active;
     $this->mainMenu = $mainMenu;
     $this->sidebarMenu = $sidebarMenu;
     $this->is_init = true;
 }
Example #15
0
<?php

$action = 'item';
$base_url = 'http://' . F::sg('site', 'imageDomain');
$id = $_SESSION['store']['store_id'];
$type = 'store';
Yii::app()->getClientScript()->registerScript('editorparam', 'window.KEDITOR_PARAM = "action=' . $action . '&base_url=' . $base_url . '&id=' . $id . '&type=' . $type . '"', CClientScript::POS_HEAD);
//    Yii::app()->getClientScript()->registerScript('editorparam', 'window.KEDITOR_PARAM = "action=' . $action . '&id=' . $id . '"', CClientScript::POS_HEAD);
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'item-form', 'htmlOptions' => array('enctype' => 'multipart/form-data', 'class' => 'form-horizontal')));
?>


<?php 
echo TbHtml::alert(TbHtml::ALERT_COLOR_INFO, '<p class="help-block">带 <span class="required">*</span> 的字段为必填项.</p>');
$this->widget('bootstrap.widgets.TbTabs', array('tabs' => array(array('label' => '基本信息', 'content' => $this->renderPartial("_form_base", array('model' => $model, 'form' => $form), true), 'active' => true), array('label' => '详细描述', 'content' => $this->renderPartial("_form_desc", array("model" => $model, 'form' => $form, 'action' => $action, 'base_url' => $base_url, 'id' => $id, 'type' => $type), true)), array('label' => '其他信息', 'content' => $this->renderPartial("_form_other", array("model" => $model, 'form' => $form), true)), array('label' => '商品类型', 'content' => $this->renderPartial("_form_type", array("model" => $model, 'form' => $form), true)), array('label' => '商品分类', 'content' => $this->renderPartial("_form_categories", array("model" => $model, 'form' => $form), true)), array('label' => '商品图片', 'content' => $this->renderPartial("_form_image", array('image' => $image, 'form' => $form, 'upload' => $upload, 'id' => $id, 'item' => $model), true)))));
?>

<?php 
echo TbHtml::formActions(array(TbHtml::submitButton('Submit', array('color' => TbHtml::BUTTON_COLOR_PRIMARY)), TbHtml::resetButton('Reset')));
?>

<?php 
$this->endWidget();
Example #16
0
 /**
  * Send to user mail
  */
 public static function sendMail($email, $subject, $message)
 {
     //        $adminEmail = Yii::app()->params['adminEmail'];
     //        $headers = "MIME-Version: 1.0\r\nFrom: $adminEmail\r\nReply-To: $adminEmail\r\nContent-Type: text/html; charset=utf-8";
     //        $message = wordwrap($message, 70);
     //        $message = str_replace("\n.", "\n..", $message);
     //        return mail($email, '=?UTF-8?B?' . base64_encode($subject) . '?=', $message, $headers);
     $adminEmail = F::sg('mail', 'adminEmail');
     header("Content-type:text/html; charset=utf-8");
     $mailer = Yii::app()->mailer;
     $mailer->Host = F::sg('mail', 'server');
     $mailer->Port = F::sg('mail', 'port');
     $mailer->SMTPAuth = true;
     if (F::sg('mail', 'ssl')) {
         $mailer->SMTPSecure = "ssl";
     }
     $mailer->Username = F::sg('mail', 'user');
     $mailer->Password = F::sg('mail', 'password');
     $mailer->IsSMTP();
     $mailer->From = $adminEmail;
     $mailer->AddReplyTo($adminEmail);
     $mailer->AddAddress($email);
     $mailer->FromName = Yii::app()->name;
     $mailer->CharSet = 'UTF-8';
     $mailer->Subject = $subject;
     $mailer->Body = $message;
     $mailer->IsHTML(true);
     //            var_dump($mailer);
     return $mailer->send();
 }
Example #17
0
<?php

$this->breadcrumbs = array('Settings' => array('index'), 'Settings');
?>

<h3>Site Settings</h3>
<p class="help-block">配置完毕,请清理缓存才会生效</p>
<?php 
echo CHtml::link('清理后台缓存', array('clear')) . '&nbsp;&nbsp;&nbsp;&nbsp;' . CHtml::link('清理前台缓存', 'http://' . F::sg('site', 'frontDomain') . '/site/clear') . '&nbsp;&nbsp;&nbsp;&nbsp;' . CHtml::link('清理店铺缓存', 'http://' . F::sg('site', 'shopDomain') . '/site/clear');
echo CHtml::errorSummary($model);
echo CHtml::beginForm();
?>
<ul class="nav nav-tabs" id="site-settings">
<?php 
$tabs = array();
$i = 0;
foreach ($model->attributes as $category => $values) {
    ?>
        <li<?php 
    echo !$i ? ' class="active"' : '';
    ?>
><a href="#<?php 
    echo $category;
    ?>
" data-toggle="tab"><?php 
    echo ucfirst($category);
    ?>
</a></li>
    <?php 
    $i++;
}
Example #18
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0047)http://ultimo.infortis-themes.com/demo/default/ -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <?php 
Yii::app()->controller->widget('comext.seo.widgets.SeoHead', array('httpEquivs' => array('Content-Type' => 'text/html; charset=utf-8', 'Content-Language' => 'en-US'), 'defaultTitle' => F::sg('seo', 'mainTitle'), 'defaultDescription' => F::sg('seo', 'mainDescr'), 'defaultKeywords' => F::sg('seo', 'mainKwrds')));
?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="robots" content="INDEX,FOLLOW">
<link rel="icon" href="http://ultimo.infortis-themes.com/demo/skin/frontend/ultimo/default/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="http://ultimo.infortis-themes.com/demo/skin/frontend/ultimo/default/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="http://ultimo.infortis-themes.com/demo/skin/frontend/ultimo/default/apple-touch-icon.png" type="image/png">
<link rel="apple-touch-icon" sizes="72x72" href="http://ultimo.infortis-themes.com/demo/skin/frontend/ultimo/default/apple-touch-icon-72x72.png" type="image/png">
<link rel="apple-touch-icon" sizes="114x114" href="http://ultimo.infortis-themes.com/demo/skin/frontend/ultimo/default/apple-touch-icon-114x114.png" type="image/png">
<!--[if lt IE 7]>
<script type="text/javascript">
//<![CDATA[
var BLANK_URL = 'http://ultimo.infortis-themes.com/demo/js/blank.html';
var BLANK_IMG = 'http://ultimo.infortis-themes.com/demo/js/spacer.gif';
//]]>
</script>
<![endif]-->

<link rel="stylesheet" type="text/css" href="<?php 
echo F::themeUrl();
?>
/media/main.css" media="all">
<link rel="stylesheet" type="text/css" href="<?php 
echo F::themeUrl();
?>
Example #19
0
 public function getImage()
 {
     $img_url = 'http://' . F::sg('site', 'imageDomain') . '/core/ad/' . $this->pic;
     return CHtml::image(F::baseUrl() . $img_url, $this->title, array('style' => 'width:600px;height:300px'));
 }
Example #20
0
File: D.php Project: zwq/unpei
 /**
  * 获取认证品牌
  * @return type
  */
 public static function getApproveBrand()
 {
     // 缓存时间,大于0时才缓存
     $queryCachingDuration = F::sg('cache', 'approveBrandCachingDuration');
     $datas = ApproveBrand::model()->cache($queryCachingDuration)->findAll();
     $data = CHtml::listData($datas, "BrandName", "BrandName");
     return $data;
 }
Example #21
0
	</div>

	<div class="row">
	    <div class="col-span-12">
		<div class="help-center background-color-2">
		<?php 
$this->widget('widgets.square.WHelpCenter');
?>
		</div>
	    </div>
	</div>

	<div class="row">
	    <div class="col-span-12">
		<div class="footer background-color-00 dark-text">
		    <?php 
$this->widget('widgets.square.WFriendLink');
?>
		    <p><?php 
$this->widget('widgets.square.WFootMenu');
?>
</p>
		    <p class="copyright">Copyright © 2012-2015 <?php 
echo CHtml::link(Yii::app()->name, 'http://' . F::sg('site', 'frontDomain'), array('target' => '_blank'));
?>
.All Rights Reserved.</p>
		</div>
	    </div>
	</div>
    </body>
</html>    
Example #22
0
                            <div class="clearfix">
                                <i class="fa fa-clock-o f_left"></i>
                                <p class="contact_e">Monday - Friday: 08.00-20.00 <br>Saturday: 09.00-15.00<br> Sunday: closed</p>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!--copyright part-->
    <div class="footer_bottom_part">
        <div class="container clearfix t_mxs_align_c">
            <p class="f_left f_mxs_none m_mxs_bottom_10">&copy; 2014 <span class="color_light">
                    <?php 
echo F::sg('site', 'name');
?>
</span>. All Rights Reserved. Powered by <a href="http://yincart.com">Yincart</a>
                <?php 
echo CHtml::link('清除缓存', array('/site/default/clear'), array('style' => 'color:grey'));
?>
            </p>
            <script type="text/javascript" src="http://js.tongji.linezing.com/2863871/tongji.js"></script><noscript><a href="http://www.linezing.com"><img src="http://img.tongji.linezing.com/2863871/tongji.gif"/></a></noscript>
            <ul class="f_right horizontal_list clearfix f_mxs_none d_mxs_inline_b">
                <li><img src="<?php 
echo F::themeUrl();
?>
/images/payment_img_1.png" alt=""></li>
                <li class="m_left_5"><img src="<?php 
echo F::themeUrl();
?>
Example #23
0
<div class="container">
    <?php 
$this->widget('xupload.XUpload', array('url' => Yii::app()->createUrl("/admin/item/upload", array("parent_id" => 1)), 'model' => $upload, 'attribute' => 'file', 'multiple' => true, 'htmlOptions' => array('id' => 'item-form')));
//echo Yii::app()->getBasePath() . "/../upload/item/image".'<br />';
//echo 'http://img.'.F::sg('site', 'domain'). "/item/image";
//echo $_SESSION['store']['store_id'];
if (!$item->isNewRecord) {
    $cri = new CDbCriteria(array('condition' => 'item_id =' . $item->item_id, 'order' => 'position'));
    $images = ItemImg::model()->findAll($cri);
    foreach ($images as $i) {
        echo CHtml::image('http://' . F::sg('site', 'imageDomain') . '/store/' . $id . '/item/image/' . $i->url, '', array('style' => 'width:100px;padding-right:10px'));
    }
}
?>
</div>
Example #24
0
 /**
  * actionUpload
  *
  * @access public
  * @return void
  */
 public function actionUpload($token)
 {
     Yii::import("xupload.models.XUploadForm");
     //Here we define the paths where the files will be stored temporarily
     $path = realpath(Yii::app()->getBasePath() . "/../upload/store") . "/0/";
     $publicPath = 'http://' . F::sg('site', 'imageDomain') . "/store/0/";
     if (!file_exists($path)) {
         mkdir($path, 0777, true);
     }
     $ymd = date("Ymd");
     $path .= $ymd . '/';
     if (!file_exists($path)) {
         mkdir($path, 0777, true);
     }
     //This is for IE which doens't handle 'Content-type: application/json' correctly
     header('Vary: Accept');
     if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false) {
         header('Content-type: application/json');
     } else {
         header('Content-type: text/plain');
     }
     //Here we check if we are deleting and uploaded file
     if (isset($_GET["_method"])) {
         if ($_GET["_method"] == "delete") {
             if ($_GET["file"][0] !== '.') {
                 $file = $path . $_GET["file"];
                 if (is_file($file)) {
                     unlink($file);
                 }
             }
             echo json_encode(true);
         }
     } else {
         $model = new XUploadForm();
         $model->file = CUploadedFile::getInstance($model, 'file');
         //We check that the file was successfully uploaded
         if ($model->file !== null) {
             $file_array = array('jpg', 'png', 'gif');
             if (!in_array($model->file->getExtensionName(), $file_array)) {
                 //                    header('HTTP/1.1 status 400 acceptFileTypes');
                 echo json_encode(array(array("error" => 'acceptFileTypes')));
                 return;
             }
             //Grab some data
             $model->mime_type = $model->file->getType();
             $model->size = $model->file->getSize();
             $model->name = $model->file->getName();
             //(optional) Generate a random name for our file
             $filename = date("YmdHis") . '_' . rand(10000, 99999);
             $filename .= "." . $model->file->getExtensionName();
             //$filename =  $ymd . '/' . $filename;
             if ($model->validate()) {
                 //Move our file to our temporary dir
                 $model->file->saveAs($path . $filename);
                 chmod($path . $filename, 0777);
                 //here you can also generate the image versions you need
                 //using something like PHPThumb
                 //Now we need to save this path to the user's session
                 $userImages = Yii::app()->cache->get('images_' . $token);
                 $userImages = $userImages ? $userImages : array();
                 $userImages[] = array("path" => $path . $filename, "thumb" => $path . $filename, "filename" => $filename, "url" => $ymd . '/' . $filename, 'size' => $model->size, 'mime' => $model->mime_type, 'name' => $model->name);
                 Yii::app()->cache->set('images_' . $token, $userImages, 60 * 60 * 2);
                 //Now we need to tell our widget that the upload was succesfull
                 //We do so, using the json structure defined in
                 //https://github.com/blueimp/jQuery-File-Upload/wiki/Setup
                 echo json_encode(array(array("name" => $model->name, "type" => $model->mime_type, "size" => $model->size, "url" => $publicPath . $ymd . '/' . $filename, "thumbnail_url" => $publicPath . $ymd . '/' . "{$filename}", "delete_url" => $this->createUrl("upload", array("_method" => "delete", "file" => $filename)), "delete_type" => "POST")));
             } else {
                 //If the upload failed for some reason we log some data and let the widget know
                 echo json_encode(array(array("error" => $model->getErrors('file'))));
                 Yii::log("XUploadAction: " . CVarDumper::dumpAsString($model->getErrors()), CLogger::LEVEL_ERROR, "xupload.actions.XUploadAction");
             }
         } else {
             throw new CHttpException(500, "Could not upload file");
         }
     }
 }
Example #25
0
 public static function initMenu($route = '', $identity = 'unknown')
 {
     // 缓存时间,大于0时才缓存
     $menuCachingDuration = F::sg('cache', 'menuCachingDuration');
     if ($menuCachingDuration > 0) {
         $cache = Yii::app()->cache;
         $menu_key = "menu_" . $identity . "_" . $route;
         $cacheMenu = $cache->get($menu_key);
         if (!empty($cacheMenu) && (!empty($cacheMenu['mainMenu']) || !empty($cacheMenu['sidebarMenu']) || !empty($cacheMenu['sidebarMenu']))) {
             return $cacheMenu;
         }
     }
     // 不同角色有不同的主菜单
     $mainMenu = F::sg('menu', 'defaultMainMenu');
     if ($identity == 'maker') {
         $mainMenu = F::sg('menu', 'makerMainMenu');
     } else {
         if ($identity == 'dealer') {
             $mainMenu = F::sg('menu', 'dealerMainMenu');
         } else {
             if ($identity == 'servicer') {
                 $mainMenu = F::sg('menu', 'servicerMainMenu');
             }
         }
     }
     // 主菜单信息
     //$main_key = "mainmenu_".$mainMenu;
     //$main = $cache->get($main_key);
     //if(!$main) {
     $main = Menu::model()->cache($menuCachingDuration)->findByPk($mainMenu);
     //	$cache->set($main_key,$main);
     //}
     if (!$main || count($main) == 0) {
         return;
     }
     // 主菜单的所有子菜单信息
     $descendants = array();
     //$descendants_key = $main_key."_descendants";
     //$descendants = $cache->get($descendants_key);
     //if(!$descendants){
     //$descendants = $main->children()->findAll("if_show=:if_show",array(":if_show"=>1));
     $descendants = $main->descendants()->cache($menuCachingDuration)->findAll("if_show=:if_show", array(":if_show" => 1));
     //	$cache->set($descendants_key,$descendants);
     //}
     $level = $main->level + 1;
     $activeMainItem = 0;
     $activeRouteMainItem = 0;
     $firstMainItem = 0;
     $currentMainItem = 0;
     $mainMenu = array();
     $activeSidebarItem = 0;
     $sidebarMenu = array();
     $findActive = false;
     $preLevel = 0;
     $preItem = 0;
     $active = array();
     foreach ($descendants as $n => $descendant) {
         $menu = array('label' => $descendant->name, 'url' => $descendant->url ? Yii::app()->request->baseUrl . '/' . $descendant->url : '#', 'active' => false, 'level' => $descendant->level, 'haschild' => false);
         // 查找主菜单
         if ($descendant->level == $level) {
             $currentMainItem = $descendant->id;
             // 如果子菜单URL属性与当前路径对应,表示找到当前活动子菜单,则当前的主菜单为活动主菜单
             if (!$findActive) {
                 $activeMainItem = $descendant->id;
                 // 每次变换主菜单,子菜单重新初始化
                 $sidebarMenu = array();
                 // 将主菜单加入到子菜单的第一项
                 $sidebarMenu[$descendant->id] = $menu;
                 $sidebarMenu[$descendant->id]['haschild'] = true;
             }
             // 如果子菜单URL属性与当前路径对应,表示找到当前活动子菜单
             if (!$findActive && self::isItemActive($descendant, $route)) {
                 $activeRouteMainItem = $descendant->id;
             }
             if ($firstMainItem == 0) {
                 $firstMainItem = $descendant->id;
             }
             // 写主菜单组
             $mainMenu[$descendant->id] = $menu;
         } else {
             if ($currentMainItem == $activeMainItem && $descendant->level > $level) {
                 // 如果子菜单URL属性与当前路径对应,表示找到当前活动子菜单
                 if (!$findActive && self::isItemActive($descendant, $route)) {
                     $activeSidebarItem = $descendant->id;
                     //$menu['active'] = true;
                     $findActive = true;
                 }
                 // 子菜单如果有多级,则父级子菜单需要标注为父菜单,切删除最父主菜单
                 if ($descendant->level > $preLevel && $preLevel != 0) {
                     $sidebarMenu[$preItem]['haschild'] = true;
                     unset($sidebarMenu[$currentMainItem]);
                 }
                 // 写子菜单组
                 $sidebarMenu[$descendant->id] = $menu;
                 $preLevel = $descendant->level;
                 $preItem = $descendant->id;
             }
         }
     }
     if (!$findActive) {
         if ($activeRouteMainItem > 0) {
             $activeMainItem = $activeRouteMainItem;
         } else {
             $activeMainItem = $firstMainItem;
         }
         $sidebarMenu = array();
     }
     $mainMenu[$activeMainItem]['active'] = true;
     if ($findActive) {
         $sidebarMenu[$activeSidebarItem]['active'] = true;
     }
     $active['sidebarMenu'] = $activeSidebarItem;
     $active['mainMenu'] = $activeMainItem;
     // 设置缓存
     $dbMenu = array('activeMenu' => $active, 'mainMenu' => $mainMenu, 'sidebarMenu' => $sidebarMenu);
     if ($menuCachingDuration) {
         $cache = Yii::app()->cache;
         $cache->set($menu_key, $dbMenu);
     }
     return $dbMenu;
 }
Example #26
0
<section class="h_bot_part container">
    <div class="clearfix row">
        <div class="col-lg-6 col-md-6 col-sm-4 t_xs_align_c">
            <?php 
echo CHtml::link(CHtml::image(F::baseUrl() . F::sg('site', 'logo')), array('/site/default/index'), array('class' => 'logo m_xs_bottom_15 d_xs_inline_b'));
?>
        </div>
        <div class="col-lg-6 col-md-6 col-sm-8">
            <div class="row clearfix">
                <div class="col-lg-6 col-md-6 col-sm-6 t_align_r t_xs_align_c m_xs_bottom_15">
                    <dl class="l_height_medium">
                        <dt class="f_size_small">Call us for free:</dt>
                        <dd class="f_size_ex_large color_dark"><b>(123) 456-7890</b></dd>
                    </dl>
                </div>
                <div class="col-lg-6 col-md-6 col-sm-6">
                    <form class="relative type_2" role="search">
                        <input type="text" placeholder="Search" name="search" class="r_corners f_size_medium full_width">
                        <button class="f_right search_button tr_all_hover f_xs_none">
                            <i class="fa fa-search"></i>
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>
Example #27
0
 public function actionClear()
 {
     Yii::app()->cache->flush();
     $this->redirect('http://' . F::sg('site', 'backDomain') . '/settings/index');
 }