当前位置: 首页>>代码示例>>PHP>>正文


PHP Menu::model方法代码示例

本文整理汇总了PHP中Menu::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::model方法的具体用法?PHP Menu::model怎么用?PHP Menu::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Menu的用法示例。


在下文中一共展示了Menu::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionIndex

 public function actionIndex()
 {
     //lay 1 tin moi de hien thi phan tin tuc
     $headTab = new Menu();
     $numHeadTab1 = $headTab->model()->find('alias="tin-dia-phuong"')->id;
     $cdbNewsLocal = new CDbCriteria();
     $cdbNewsLocal->order = 'datecreate DESC';
     $cdbNewsLocal->limit = 1;
     $cdbNewsLocal->condition = 'idmenu =' . $numHeadTab1;
     $modelNewsLocal = News::model()->find($cdbNewsLocal);
     if ($modelNewsLocal === NULL) {
         Yii::app()->user->setFlash('LocalEmpty', 'Dữ liệu đang cập nhật');
         $modelLocalMore = Yii::app()->user->setFlash('LocalEmptyMore', 'Dữ liệu đang cập nhật');
     } else {
         //lay 4 tin khac de hien thi phan tin tuc
         $cdbLocalMore = new CDbCriteria();
         $cdbLocalMore->limit = 4;
         $cdbLocalMore->order = 'datecreate DESC';
         $cdbLocalMore->condition = 'id NOT IN ("' . $modelNewsLocal->id . '") AND idmenu=' . $modelNewsLocal->idmenu;
         $modelLocalMore = News::model()->findAll($cdbLocalMore);
     }
     //lay 1 tin moi de hien thi phan Tin cong nghe
     $numHeadTab2 = $headTab->model()->find('alias="tin-cong-nghe"')->id;
     $cdbNewsTech = new CDbCriteria();
     $cdbNewsTech->order = 'datecreate DESC';
     $cdbNewsTech->limit = 1;
     $cdbNewsTech->condition = 'idmenu =' . $numHeadTab2;
     $modelNewsTech = News::model()->find($cdbNewsTech);
     if ($modelNewsTech === NULL) {
         Yii::app()->user->setFlash('emptyData', 'Dữ liệu đang cập nhật');
         $modelTechMore = Yii::app()->user->setFlash('emptyDataMore', 'Dữ liệu đang cập nhật');
     } else {
         //lay 2 tin khac de hien thi phan Tin cong nghe
         $cdbTechMore = new CDbCriteria();
         $cdbTechMore->limit = 2;
         $cdbTechMore->order = 'datecreate DESC';
         $cdbTechMore->condition = 'id NOT IN ("' . $modelNewsTech->id . '") AND idmenu=' . $modelNewsTech->idmenu;
         $modelTechMore = News::model()->findAll($cdbTechMore);
     }
     //lay 1 tin moi de hien thi phan Thong bao
     $numHeadTab3 = $headTab->model()->find('alias="thong-bao"')->id;
     $cdbNewsNotify = new CDbCriteria();
     $cdbNewsNotify->order = 'datecreate DESC';
     $cdbNewsNotify->limit = 1;
     $cdbNewsNotify->condition = 'idmenu =' . $numHeadTab3;
     $modelNewsNotify = News::model()->find($cdbNewsNotify);
     if ($modelNewsNotify === NULL) {
         Yii::app()->user->setFlash('NofifyEmpty', 'Dữ liệu đang cập nhật');
         $modelNotifyMore = Yii::app()->user->setFlash('MoreNofifyEmpty', 'Dữ liệu đang cập nhật');
     } else {
         //lay 2 tin khac de hien thi phan Tin cong nghe
         $cdbNotifyMore = new CDbCriteria();
         $cdbNotifyMore->limit = 2;
         $cdbNotifyMore->order = 'datecreate DESC';
         $cdbNotifyMore->condition = 'id NOT IN ("' . $modelNewsNotify->id . '") AND idmenu=' . $modelNewsNotify->idmenu;
         $modelNotifyMore = News::model()->findAll($cdbNotifyMore);
     }
     $this->render('index', array('modelNewsLocal' => $modelNewsLocal, 'modelLocalMore' => $modelLocalMore, 'modelNewsTech' => $modelNewsTech, 'modelTechMore' => $modelTechMore, 'modelNewsNotify' => $modelNewsNotify, 'modelNotifyMore' => $modelNotifyMore));
 }
开发者ID:hntvu,项目名称:db_for_site,代码行数:59,代码来源:SiteController.php

示例2: loadModel

 public function loadModel($id)
 {
     if (($model = Menu::model()->findByPk($id)) === null) {
         throw new CHttpException(404, Yii::t('MenuModule.menu', 'Page was not found!'));
     }
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:7,代码来源:MenuBackendController.php

示例3: activate

 public function activate(Plugin $plugin)
 {
     $data = $plugin->getData();
     if ($data === null) {
         $data = array();
     }
     if (isset($data['id_menu']) && is_numeric($data['id_menu'])) {
         // не должно быть такого
         return;
     }
     if (Menu::model()->exists('id=:id', array(':id' => 108))) {
         // на сайте изначально был установлен данный плагин.
         // записываем данные по умолчанию
         $data['id_menu'] = 108;
         $data['id_event_type'] = 103;
     } else {
         $eventType = $this->prepareEventType('Вопрос-ответ » Новый вопрос');
         $eventType->save();
         $data['id_event_type'] = $eventType->id_event_type;
         // создаем раздел меню
         $menu = $this->prepareMenu('Вопрос-ответ', 'Вопрос-ответ', 'faq', '/faq/', isset($data['id_menu_module_template']) ? $data['id_menu_module_template'] : null);
         $menu->save();
         $data['id_menu'] = $menu->id;
         $this->createPermission($data['id_object'], 'Просмотр списка данных объекта Вопрос-ответ');
         $this->updateMenu = true;
     }
     $plugin->setData($data);
     $plugin->setConfig($this->getConfigByParamsValue($plugin->getParamsValue(), $data));
 }
开发者ID:kot-ezhva,项目名称:ygin,代码行数:29,代码来源:FaqPlugin.php

示例4: activate

 public function activate(Plugin $plugin)
 {
     $data = $plugin->getData();
     if ($data === null) {
         $data = array();
     }
     if (isset($data['id_menu']) && is_numeric($data['id_menu'])) {
         // не должно быть такого
         return;
     }
     if (Menu::model()->exists('id=:id', array(':id' => 116))) {
         // на сайте изначально был установлен данный плагин.
         // записываем данные по умолчанию
         $data['id_menu'] = 116;
         $data['id_site_module'] = 114;
     } else {
         // модуль ещё не установлен на сайте
         // создаем раздел меню и модуль сайта
         $menu = $this->prepareMenu('Опрос', 'Опрос', 'vote', '/vote/', isset($data['id_menu_module_template']) ? $data['id_menu_module_template'] : null, false);
         $menu->save();
         $siteModule = $this->prepareSiteModule('Голосование', $data['id_php_script_type_module']);
         $siteModule->save();
         if (!empty($data['site_module_place'])) {
             $this->restoreSiteModulePlace($siteModule->id_module, $data['site_module_place']);
             unset($data['site_module_place']);
         }
         $this->createPermission($data['id_object_voting'], 'Просмотр списка данных объекта Опросы');
         $this->createPermission($data['id_object_voting_answer'], 'Просмотр списка данных объекта Варианты ответов в опросах');
         $this->updateMenu = true;
         $data['id_menu'] = $menu->id;
         $data['id_site_module'] = $siteModule->id_module;
     }
     $plugin->setData($data);
 }
开发者ID:kot-ezhva,项目名称:ygin,代码行数:34,代码来源:VotePlugin.php

示例5: actionManager

 public function actionManager()
 {
     $moduleType = EnvUtil::getRequest("op");
     if (!in_array($moduleType, array("installed", "uninstalled"))) {
         $moduleType = "installed";
     }
     if ($moduleType == "uninstalled") {
         $moduleDirs = ModuleUtil::getModuleDirs();
         if (!empty($moduleDirs)) {
             $moduleDirs = ModuleUtil::filterInstalledModule(Module::model()->fetchAllSortByPk("module"), $moduleDirs);
         }
         $modules = ModuleUtil::initModuleParameters($moduleDirs);
     } else {
         $modules = Module::model()->fetchAll(array("order" => "iscore ,installdate desc"));
         foreach ($modules as $index => $module) {
             $menu = Menu::model()->fetchByModule($module["module"]);
             if (!empty($menu)) {
                 $route = $menu["m"] . "/" . $menu["c"] . "/" . $menu["a"];
                 $param = StringUtil::splitParam($menu["param"]);
                 $module["managerUrl"] = Ibos::app()->urlManager->createUrl($route, $param);
             } else {
                 $module["managerUrl"] = "";
             }
             $modules[$index] = $module;
         }
     }
     $data = array("modules" => $modules);
     $this->render("module" . ucfirst($moduleType), $data);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:29,代码来源:ModuleController.php

示例6: concatenatedToBuildMenu

 private function concatenatedToBuildMenu($in, $valor)
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id_menu_sistema', $in);
     $criteria->compare('padre', $valor);
     $criteria->compare('estatus', 1);
     $criteria->order = 'nivel';
     $menus = Menu::model()->findAll($criteria);
     $mostrar = array();
     foreach ($menus as $menu) {
         $criteria = new CDbCriteria();
         $criteria->addInCondition('id_menu_sistema', $in);
         $criteria->compare('padre', $valor);
         $criteria->compare('estatus', 1);
         $contadorHijos = Menu::model()->count($criteria);
         if ($contadorHijos == 0) {
             $mostrar[] = array('label' => 'Inicio', 'url' => array('/site/index'));
         } else {
             $addMostrar = array('label' => $menu->nombre, 'url' => array($menu->ruta), 'style' => 'home', 'items' => $this->concatenatedToBuildMenu($in, $menu->id_menu_sistema));
             if ($menu->style != '') {
                 $addMostrar['style'] = $menu->style;
             }
             $mostrar[] = $addMostrar;
         }
     }
     return $mostrar;
 }
开发者ID:jolopez17,项目名称:testcantv,代码行数:27,代码来源:WebUser.php

示例7: actionIndex

 public function actionIndex()
 {
     $this->checkCookieEnabled();
     $this->htmlPageId = 'index';
     $page = Menu::model()->findByPk(InfoPages::MAIN_PAGE_ID);
     if (issetModule('seo')) {
         $seo = SeoFriendlyUrl::model()->findByAttributes(array('model_name' => 'InfoPages', 'model_id' => InfoPages::MAIN_PAGE_ID));
         if ($seo) {
             $this->setSeo($seo);
         }
     }
     $langs = Lang::getActiveLangs();
     $countLangs = count($langs);
     if (!isFree() && !isset($_GET['lang']) && ($countLangs > 1 || $countLangs == 1 && param('useLangPrefixIfOneLang'))) {
         $canonicalUrl = Yii::app()->getBaseUrl(true);
         $canonicalUrl .= '/' . Yii::app()->language;
         Yii::app()->clientScript->registerLinkTag('canonical', null, $canonicalUrl);
     }
     Yii::app()->user->setState('searchUrl', NULL);
     $lastNews = News::getLastNews();
     if (Yii::app()->request->isAjaxRequest) {
         //			$modeListShow = User::getModeListShow();
         //			if ($modeListShow == 'table') {
         //				# нужны скрипты и стили, поэтому processOutput установлен в true только для table
         //				$this->renderPartial('index', array('page' => $page, 'newsIndex' => $lastNews), false, true);
         //			}
         //			else {
         $this->renderPartial('index', array('page' => $page, 'newsIndex' => $lastNews));
         //			}
     } else {
         $this->render('index', array('page' => $page, 'newsIndex' => $lastNews));
     }
 }
开发者ID:barricade86,项目名称:raui,代码行数:33,代码来源:SiteController.php

示例8: actionSearch

 public function actionSearch($type = 'all')
 {
     if (!param('useShowUserInfo')) {
         throw new CHttpException(403, tt('Displays information about the users is disabled by the administrator', 'users'));
     }
     $usersListPage = Menu::model()->findByPk(Menu::USERS_LIST_ID);
     if ($usersListPage) {
         if ($usersListPage->active == 0) {
             throw404();
         }
     }
     $this->showSearchForm = false;
     $existTypes = User::getTypeList('withAll');
     $criteria = new CDbCriteria();
     $type = in_array($type, array_keys($existTypes)) ? $type : 'all';
     //$criteria->compare('active', 1);
     if ($type != 'all') {
         $criteria->compare('type', $type);
     }
     //$criteria->compare('isAdmin', 0);
     $criteria->with = array('countAdRel');
     $sort = new CSort();
     $sort->sortVar = 'sort';
     $sort->defaultOrder = 'date_created DESC';
     $sort->multiSort = true;
     $sort->attributes = array('username' => array('label' => tc('by username'), 'default' => 'desc'), 'date_created' => array('label' => tc('by date of registration'), 'default' => 'desc'));
     $dataProvider = new CActiveDataProvider(User::model()->active(), array('criteria' => $criteria, 'sort' => $sort, 'pagination' => array('pageSize' => 12)));
     $this->render('search', array('dataProvider' => $dataProvider, 'type' => $type));
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:29,代码来源:MainController.php

示例9: actionIndex

 public function actionIndex()
 {
     $page = Menu::model()->findByPk(InfoPages::MAIN_PAGE_ID);
     $langs = Lang::getActiveLangs();
     $countLangs = count($langs);
     if (!isFree() && !isset($_GET['lang']) && ($countLangs > 1 || $countLangs == 1 && param('useLangPrefixIfOneLang'))) {
         $canonicalUrl = Yii::app()->getBaseUrl(true);
         $canonicalUrl .= '/' . Yii::app()->language;
         Yii::app()->clientScript->registerLinkTag('canonical', null, $canonicalUrl);
     }
     Yii::app()->user->setState('searchUrl', NULL);
     $criteriaNews = new CDbCriteria();
     $criteriaNews->limit = 10;
     $criteriaNews->order = 'date_created DESC';
     $newsIndex = News::model()->findAll($criteriaNews);
     if (isset($_GET['is_ajax'])) {
         //			$modeListShow = User::getModeListShow();
         //			if ($modeListShow == 'table') {
         //				# нужны скрипты и стили, поэтому processOutput установлен в true только для table
         //				$this->renderPartial('index', array('page' => $page, 'newsIndex' => $newsIndex), false, true);
         //			}
         //			else {
         $this->renderPartial('index', array('page' => $page, 'newsIndex' => $newsIndex));
         //			}
     } else {
         $this->render('index', array('page' => $page, 'newsIndex' => $newsIndex));
     }
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:28,代码来源:SiteController.php

示例10: loadModel

 public function loadModel($id)
 {
     if (($model = Menu::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-kamin,代码行数:7,代码来源:MenuBackendController.php

示例11: deleteMenu

 protected function deleteMenu($menuId)
 {
     $menuItems = MenuItem::model()->findAllByAttributes(array('menuId' => $menuId));
     foreach ($menuItems as $item) {
         $item->delete();
     }
     Menu::model()->deleteByPk($menuId);
 }
开发者ID:DarkAiR,项目名称:test,代码行数:8,代码来源:ExtendedDbMigration.php

示例12: run

 public function run()
 {
     parent::run();
     $criteria = new CDbCriteria();
     $criteria->order = 't.order ASC';
     $menu = Menu::model()->findAll($criteria);
     $this->render('home_menu_bar');
 }
开发者ID:nctruong,项目名称:inputen,代码行数:8,代码来源:home_menu_bar.php

示例13: 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 $id the ID of the model to be loaded
  *
  * @throws CHttpException
  *
  * @return Menu
  */
 public function loadModel($id)
 {
     $model = Menu::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:rash012,项目名称:cms,代码行数:18,代码来源:MenuController.php

示例14: run

 public function run()
 {
     parent::run();
     $criteria = new CDbCriteria();
     $criteria->order = 't.order ASC';
     $menu = Menu::model()->findAll($criteria);
     $data['adv'] = Advertisement::model()->findAll("state = 1");
     $this->render('bottom_logos', $data);
 }
开发者ID:nctruong,项目名称:inputen,代码行数:9,代码来源:bottom_logos.php

示例15: createLinks

 public static function createLinks()
 {
     $menuItems = Menu::model()->findAll();
     foreach ($menuItems as $menuItem) {
         $makeLink = "make" . ucfirst($menuItem->link_type) . "Link";
         $menuItem->link = self::$makeLink($menuItem->link);
     }
     return self::makeMenuArray($menuItems);
 }
开发者ID:IlyaSavich,项目名称:mini-cms,代码行数:9,代码来源:MenuManager.php


注:本文中的Menu::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。