public function actionFinduser()
 {
     $result = array();
     $result1 = array();
     $data = $_POST['searchword'];
     $user = UserProfile::model()->findAll('first_name LIKE :name', array(':name' => "%{$data}%"));
     $page = Pages::model()->findAll('company_name LIKE :name', array(':name' => "%{$data}%"));
     $result = array_merge($user, $page);
     shuffle($result);
     //       foreach($result as $r):
     //           print_r($r['attributes']);
     //       endforeach;
     //       return;
     foreach ($result as $u) {
         $html = '<div class="display_box" align="left" style="position:relative; z-index:3;">';
         if (isset($u['first_name'])) {
             $id = $u['user_id'];
             $img = $u['image'];
             $html .= '<a  href = "' . Yii::app()->baseUrl . '/index.php/user/viewprofile/userId/' . $id . '"><img src="' . Yii::app()->baseUrl . '/uploads/user_' . $id . '/' . $img . '"style=float:left; margin-right:6px; width=40 height = 40 />&nbsp&nbsp<span style = "font-size:15px">' . $u['first_name'] . '&nbsp;' . $u['last_name'] . '<br/>';
             $html .= '&nbsp;<span style="font-size:9px; color:#999999">' . "USER" . '</span></div></a><br/>';
             echo $html;
         } elseif (isset($u['company_name'])) {
             $id = $u['user_id'];
             $img = $u['image'];
             $html .= '<a href = "' . Yii::app()->baseUrl . '/index.php/businesspage/viewpage/' . $u->id . '"><img src="' . Yii::app()->baseUrl . '/uploads/business_page_' . $id . '/' . $img . '"style="float:left; margin-right:6px" width="40px"; height ="40px"; />&nbsp<span style = "font-size:15px">' . $u['company_name'] . '&nbsp;</span>(' . $u['domain'] . ')<br/>';
             $html .= '<span style="font-size:9px; color:#999999">' . "PAGE" . '</span></div><br/>';
             echo $html;
         }
     }
 }
 public function actionSitemap()
 {
     $pages = Pages::model()->findAll();
     $news = News::model()->findAll();
     header('Content-Type: application/xml');
     $this->renderPartial('../site/sitemap', array('pages' => $pages, 'news' => $news));
 }
 public function actionIndex($id)
 {
     $model = Pages::model()->findByPk($id);
     $model->url = mb_strtolower($model->url);
     $model->url = str_replace("http://", "", $model->url);
     header('Location: http://' . $model->url);
 }
 public function actionCreate()
 {
     //echo realpath(Yii::app()->baseUrl);            return;
     $model = new Pages();
     $this->layout = 'layout_user';
     // uncomment the following code to enable ajax-based validation
     /*
     if(isset($_POST['ajax']) && $_POST['ajax']==='pages-create-form')
     {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     */
     if (isset($_POST['Pages'])) {
         $model->attributes = $_POST['Pages'];
         if ($model->validate()) {
             $page = Pages::model()->find('id=:p_id', array(':p_id' => Yii::app()->session['pageId']));
             $page->company_name = $_POST['Pages']['company_name'];
             $page->type = $_POST['Pages']['type'];
             $page->address = $_POST['Pages']['address'];
             $page->description = $_POST['Pages']['description'];
             $page->save();
             // form inputs are valid, do something here
             return;
         }
     }
     $this->render('create', array('model' => $model));
 }
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $page = Pages::model()->findByPk(1);
     $comments = Posts::model()->templates()->roots()->findAll();
     $childrens = Posts::getCountChildrens($comments);
     $this->render('index', ['page' => $page, 'comments' => $comments, 'childrens' => $childrens]);
 }
示例#6
0
 public function actionIndex($id)
 {
     $model = Pages::model()->findByPk($id);
     if (!$model || $model->status == 0) {
         throw new CHttpException(404, 'The page can not be found.');
     }
     //Титл и SEO
     $this->setSEO($model->url, mb_convert_case($model->title, MB_CASE_UPPER, "UTF-8"));
     $this->layout = '//layouts/' . $model->main_template;
     $modelCatalog = null;
     $modelNews = null;
     //Если главная - добавляю товары помеченые как на главную и новости
     if ($model->main_page == 1) {
         $modelCatalog = CatalogElements::model()->findAll('`status` = 1 AND `primary` = 1');
         $modelNews = NewsElements::gatPrimaryNews();
     }
     //Проверка прав доступа
     if ($model->access_lvl > 0) {
         if (Yii::app()->user->isGuest) {
             $this->redirect('/login');
         }
     }
     //Проверяем есть ли фотогалерея, если есть - меняем содержимое страницы
     $model->content = $this->addPhotogalery($model->content);
     //Проверяем есть ли форма, если есть - меняем содержимое страницы
     $model->content = $this->addForm($model->content);
     //Получаем вкладки если есть;
     $modelTabs = PagesTabs::model()->getTabsContent($id);
     $this->render('index', array('model' => $model, 'modelTabs' => $modelTabs, 'modelCatalog' => $modelCatalog, 'modelNews' => $modelNews));
 }
示例#7
0
 public function run()
 {
     $page_id = $this->page_id;
     $controller = Yii::app()->getController();
     $model = new ModuleList3();
     if (!is_null($page_id) && Pages::model()->existsPage($page_id)) {
         $this->create_item($page_id, $model);
         $this->update_order($page_id);
         $mpage_id = ModulesInPages::model()->getLink((int) $page_id, $this->module_id);
         if ($mpage_id == 5) {
             $mpage_id = 4;
         }
         if ($mpage_id == 54) {
             $mpage_id = 4;
         }
         if ($mpage_id == 56) {
             $mpage_id = 4;
         }
         if ($mpage_id == 58) {
             $mpage_id = 4;
         }
         $params_list = ModuleList3Params::model()->getList($mpage_id);
         $this->render('module_list3', array('model' => $model, 'params_list' => $params_list, 'page_id' => $page_id));
     } else {
         $controller->redirect(Yii::app()->request->scriptUrl);
     }
 }
示例#8
0
 public function setSEO($url_patch, $page_title = null, $modelSEO = null)
 {
     $url_patch = trim($url_patch);
     $this->pageTitle = (!empty($page_title) ? $page_title . ' - ' : '') . $this->pageTitle;
     $url_array = explode("/", parse_url($url_patch, PHP_URL_PATH));
     foreach ($url_array as $url) {
         $model = Pages::model()->find('url LIKE "' . $url . '"');
         if ($model) {
             if (!empty($model->meta_title)) {
                 $this->pageTitle = $model->meta_title;
                 $this->pageMetaTitle = $model->meta_title;
             }
             if (!empty($model->meta_keywords)) {
                 $this->pageKeywords = $model->meta_keywords;
             }
             if (!empty($model->meta_description)) {
                 $this->pageDescription = $model->meta_description;
             }
         }
     }
     if (!empty($modelSEO)) {
         if (isset($modelSEO->meta_title) && !empty($modelSEO->meta_title)) {
             $this->pageTitle = $modelSEO->meta_title;
             $this->pageMetaTitle = $modelSEO->meta_title;
         }
         if (isset($modelSEO->meta_keywords) && !empty($modelSEO->meta_keywords)) {
             $this->pageKeywords = $modelSEO->meta_keywords;
         }
         if (isset($modelSEO->meta_description) && !empty($modelSEO->meta_description)) {
             $this->pageDescription = $modelSEO->meta_description;
         }
     }
     return true;
 }
示例#9
0
 protected function getPages()
 {
     if (!$this->_pages) {
         $c = new CDbCriteria();
         $this->_pages = Pages::model()->findAll($c);
     }
     return $this->_pages;
 }
示例#10
0
 public function run()
 {
     $criteria = new CDbCriteria();
     $criteria->select = 'name, title';
     $criteria->order = 'name';
     $model = Pages::model()->findAll($criteria);
     $this->render('widgetPages', array('model' => $model));
 }
示例#11
0
 public function loadModel($id)
 {
     $model = Pages::model()->not_deleted()->findByPk($id);
     if (!$model) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#12
0
 public function getAllAction()
 {
     $criteria = new CDbCriteria();
     $result = Pages::model()->findAll($criteria);
     if ($result) {
         return CHtml::listData($result, 'slug', 'slug');
     }
     return array();
 }
示例#13
0
 public static function getNewsInfoForNavs()
 {
     $news = Pages::model()->findAll('type=:type', array(':type' => 'news'));
     $newsInfos = array();
     foreach ($news as $new) {
         $newsInfo = array('title' => $new->title, 'url' => Yii::app()->createUrl('admin/news', array('id' => $new->id)));
         array_push($newsInfos, $newsInfo);
     }
     return $newsInfos;
 }
示例#14
0
 public function actionLocal()
 {
     //$this->checkAccess('Admin');
     $page = Pages::model()->find('alias=:alias', array('alias' => 'local'));
     $this->pageTitle = $page->lang->title ? $page->lang->title : Yii::t('app', 'Локальный сервер');
     $this->pageDescription = $page->lang->meta_description;
     $this->pageKeywords = $page->lang->meta_keywords;
     $this->layout = 'home';
     $this->render('local', array('page' => $page));
 }
示例#15
0
 public function run($page_name = 'index')
 {
     $dependency = new CDbCacheDependency("SELECT MAX(UNIX_TIMESTAMP(updated_at)) FROM {{pages}} WHERE page = :page AND status = :status AND lang = :lang");
     $dependency->params = array('page' => $page_name, 'status' => ActiveRecord::STATUS_ON, 'lang' => app()->getLanguage());
     $model = Pages::model()->cache(3600 * 24, $dependency)->opened()->find('page = :page AND lang = :lang', array('page' => $page_name, 'lang' => app()->getLanguage()));
     if ($model === NULL) {
         throw new CHttpException(404, Yii::t('main', 'Страница не найдена.'));
     }
     app()->getController()->render('//page', array('model' => $model));
 }
示例#16
0
 public function actionIndex($page_id = null)
 {
     if (!is_null($page_id) && Pages::model()->existsPage($page_id)) {
         $data = array();
         $link_id = ModulesInPages::model()->getLink($page_id, $this->module->id);
         if ($link_id) {
             $data = ModuleActionsData::model()->getList($link_id);
         }
         $this->render('index', array('page_id' => $page_id, 'data' => $data, 'module_id' => $this->module->id));
     }
 }
示例#17
0
 public function deactivation($page_id = null)
 {
     $result = false;
     if (!is_null($page_id) && Pages::model()->existsPage($page_id)) {
         $link_id = ModulesInPages::model()->getLink($page_id, $this->id);
         if ($link_id) {
             $result = ModuleHelper::model()->deactivation($link_id, $this->id);
         }
     }
     return $result;
 }
示例#18
0
 /**
  *  Вызывается при редактировании страницы, на которой активирован этот модуль
  */
 public function run()
 {
     $page_id = $this->page_id;
     $controller = Yii::app()->getController();
     $model = new ModuleYmapsCategories();
     if (!is_null($page_id) && Pages::model()->existsPage($page_id)) {
         $this->create_item($page_id, $model);
         $this->render('module_ymaps', array('model' => $model, 'page_id' => $page_id));
     } else {
         $controller->redirect(Yii::app()->request->scriptUrl);
     }
 }
示例#19
0
 public function actionShow($name)
 {
     $name = mysql_escape_string($name);
     $menu = Menu::model()->findByAttributes(array('title' => $name));
     if ($menu = Menu::model()->findByAttributes(array('title' => $name))) {
         $id_menu = $menu->id_menu;
         if ($page = Pages::model()->findAllByAttributes(array('id_menu' => $id_menu))) {
             $this->render('view', array('page' => $page));
         }
     } else {
         echo 'Не существующий пункт меню';
     }
 }
示例#20
0
 public function actionIndex()
 {
     $sitemap = array();
     //Список текстовых страниц
     $i = 0;
     foreach (Pages::model()->findAll('status=2') as $data) {
         $k = $data->id;
         $sitemap[$i]['name'] = $data->title;
         $sitemap[$i]['url'] = '/' . $data->url;
         ++$i;
     }
     $this->render('index', array('sitemap' => $sitemap));
 }
示例#21
0
 public function deactivation($page_id = null)
 {
     $result = false;
     // доступно дл¤ пользователей первой роли (например, Ђ–еактивуї)
     $role_id = Users::model()->findByPk(Yii::app()->user->id)->role_id;
     if ($role_id < 2 && !is_null($page_id) && Pages::model()->existsPage($page_id)) {
         $link_id = ModulesInPages::model()->getLink($page_id, $this->id);
         if ($link_id) {
             $result = ModuleGallery::model()->deactivation($link_id, $this->id);
         }
     }
     return $result;
 }
示例#22
0
 public function run($page_id = null)
 {
     $page_id = $this->page_id;
     $controller = Yii::app()->getController();
     $model = new ModuleGallery();
     if (!is_null($page_id) && Pages::model()->existsPage($page_id)) {
         $this->create_item($page_id, $model);
         $mpage_id = ModulesInPages::model()->getLink($page_id, $this->module_id);
         $data = ModuleGallery::model()->getList($mpage_id);
         $this->render('module_gallery', array('model' => $model, 'page_id' => $page_id, 'data' => $data));
     } else {
         $controller->redirect(Yii::app()->request->scriptUrl);
     }
 }
示例#23
0
 public function actionList()
 {
     if (Yii::app()->user->isGuest or Yii::app()->user->access_level < Config::get('access_level_admin')) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $this->pageTitle = Yii::t('title', 'Page list');
     $criteria = new CDbCriteria();
     $criteria->select = '*';
     $criteria->order = 'id DESC';
     $pages = new CPagination(Pages::model()->count($criteria));
     $pages->pageSize = 25;
     $pages->applyLimit($criteria);
     $model = Pages::model()->findAll($criteria);
     $this->render('page_list', array('model' => $model, 'pages' => $pages));
 }
示例#24
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $this->layout = 'index';
     // one page about
     $criteriaAbout = new CDbCriteria(array('condition' => "t.key='about'"));
     $about = Pages::model()->findAll($criteriaAbout);
     // one page features
     $criteriaFeatures = new CDbCriteria(array('condition' => "t.key='features'"));
     $features = Pages::model()->findAll($criteriaFeatures);
     // one page portfolio
     $criteriaPortfolio = new CDbCriteria(array('condition' => "t.active='1'"));
     $portfolio = Portfolio::model()->findAll($criteriaPortfolio);
     $this->render('index', array('about' => $about, 'features' => $features, 'portfolio' => $portfolio));
 }
示例#25
0
 public function actionDeactivation($page_id = null)
 {
     $result = false;
     // доступно для пользователей первой роли (например, «Реактиву»)
     $role_id = Users::model()->findByPk(Yii::app()->user->id)->role_id;
     if ($role_id < 2 && !is_null($page_id) && Pages::model()->existsPage($page_id)) {
         $link_id = ModulesInPages::model()->getLink($page_id, $this->module->id);
         if ($link_id) {
             $result = ModuleFieldsFiles::model()->deactivation($link_id, $this->module->id);
         }
     }
     if ($result) {
         $this->redirect(Yii::app()->baseUrl . '?r=pages/update&id=' . $page_id . '&/#!/tab_fourth');
     } else {
         $this->redirect(Yii::app()->request->baseUrl . '/admin.php');
     }
 }
示例#26
0
 public function run()
 {
     $page_id = $this->page_id;
     $controller = Yii::app()->getController();
     $model = new ModuleHelper();
     if (!is_null($page_id) && Pages::model()->existsPage($page_id)) {
         $model = $this->create_item($page_id, $model);
         $data['model'] = $model;
         $data['page_id'] = $page_id;
         $data['tree'] = ModuleHelper::model()->getTree();
         $data['dropdown'] = ModuleHelper::model()->getDropDown($data['tree']);
         $data['list'] = ModuleHelper::model()->getList();
         $this->render('module_helper', $data);
     } else {
         $controller->redirect(Yii::app()->request->scriptUrl);
     }
 }
示例#27
0
 public function getAllMenu()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('t.status', STATUS_ACTIVE);
     if ($this->position == 0) {
         $criteria->addInCondition('t.show_footer', array(0, 2));
     }
     if ($this->position == 1) {
         $criteria->addInCondition('t.show_footer', array(1, 2));
     }
     //            $criteria->compare('t.show_footer',$this->position);
     $criteria->order = 't.order ASC,t.parent_id ASC';
     $result = Pages::model()->findAll($criteria);
     if ($result) {
         return $result;
     }
     return array();
 }
示例#28
0
 public function actionShowpage()
 {
     $url = Yii::app()->request->requestUri;
     //var_dump($url);die;
     $currentUrl = Navigation::model()->find('url=:url', array(':url' => $url));
     //var_dump($currentUrl);die;
     //var_dump($currentUrl->object_id);die;
     if ($currentUrl == NULL) {
         throw new CHttpException(404, Yii::t('yii', 'Unable to resolve the request "{route}".', array('{route}' => $url === '' ? $this->defaultController : $url)));
     }
     $page = Pages::model()->findByPk($currentUrl->object_id);
     if ($page == NULL) {
         throw new CHttpException(404, Yii::t('yii', 'Unable to resolve the request "{route}".', array('{route}' => $url === '' ? $this->defaultController : $url)));
     }
     //var_dump($page);die;
     $this->pageTitle = $page->lang->title;
     $this->data_global['page'] = $page;
     $this->layout = $this->layouts_path . $page->layout;
     $this->render('showpage', array('page' => $page));
 }
示例#29
0
 /**
  * @Author: ANH DUNG Dec 16, 2014
  * @Todo: run replace url in CMS page 
  * LiveNeedRun::ReplaceCmsLinkLiveSite();
  */
 public static function ReplaceCmsLinkLiveSite()
 {
     set_time_limit(7200);
     //        $find = 'propertyinfologic.com.sg/demo';
     //        $replace = 'propertyinfologic.com.sg';
     //        $find = 'propertyinfologic.com.sg'; // Jan 06, 2014
     //        $replace = 'www.onehome.sg'; // Jan 06, 2014
     $find = 'www.onehome.sg';
     // Feb 10, 2015 for demo new change
     //        $replace = 'verzview.com/verzpropertyinfo/demo2'; // Feb 10, 2015
     $replace = 'localhost/verz/propertyinfo';
     // Feb 10, 2015
     $models = Pages::model()->findAll();
     foreach ($models as $item) {
         $item->external_link = str_replace($find, $replace, $item->external_link);
         $item->content = str_replace($find, $replace, $item->content);
         $item->update(array('content', 'external_link'));
     }
     echo 'Done: ' . count($models);
     die;
 }
示例#30
0
 public function run()
 {
     $page_id = $this->page_id;
     $controller = Yii::app()->getController();
     $model = new ModuleFields();
     if (!is_null($page_id) && Pages::model()->existsPage($page_id)) {
         $role_id = Users::model()->findByPk(Yii::app()->user->id)->role_id;
         if ($role_id < 2) {
             // доступно для пользователей первой роли (например, «Реактиву»)
             $model = $this->create_item($page_id, $model);
             $this->update_order($page_id);
         }
         $this->update_values($page_id);
         $data_type_drop_down_list = DataType::model()->getDropDownList();
         unset($data_type_drop_down_list[5]);
         unset($data_type_drop_down_list[6]);
         $this->render('module_fields', array('model' => $model, 'data_type_drop_down_list' => $data_type_drop_down_list, 'page_id' => $page_id));
     } else {
         $controller->redirect(Yii::app()->request->scriptUrl);
     }
 }