Наследование: extends CI_Controller
 public function getlinkAction()
 {
     // Parameter auslesen
     $link_to_page_id = Request::postParam('linkToPageId');
     $link_to_language_id = Request::postParam('linkToLanguageId');
     $link_to_anchor_name = Request::postParam('linkToAnchorName');
     // Parameter überprüfen
     if (!is_numeric($link_to_page_id) || $link_to_language_id == '') {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     $pages = new Pages();
     // Die absolute URL auslesen
     $absolute_url = $pages->getPageUrl($link_to_page_id, $link_to_language_id);
     // eine zum Stammverzeichnis des CMS relative URL daraus machen
     $base_url = Config::get()->baseUrl;
     $relative_url = UTF8String::substr($absolute_url, UTF8String::strlen($base_url), UTF8String::strlen($absolute_url));
     if ($link_to_anchor_name != '') {
         if ($relative_url != '') {
             $relative_url = rtrim($relative_url, '/') . '/';
         }
         $relative_url .= '#' . $link_to_anchor_name;
     }
     // Zurückgeben
     $this->success($relative_url);
 }
Пример #2
0
 public function defaultAction()
 {
     if (Translate::getId() != '') {
         $config = Config::getArray();
         $languages = $config['backendLanguages']['list'];
         $language_id = Translate::getId();
         $strings = array();
         if (is_array($languages[$language_id]['translationClientside'])) {
             if (count($languages[$language_id]['translationClientside']) > 0) {
                 foreach ($languages[$language_id]['translationClientside'] as $translation_file) {
                     $temp = (include $translation_file);
                     $strings = array_merge($strings, $temp);
                 }
             }
         } else {
             if ($languages[$language_id]['translationClientside'] != '') {
                 $strings = (include $languages[$language_id]['translationClientside']);
             }
         }
         $this->view->assign('backendTranslation', $strings);
     } else {
         $this->view->assign('backendTranslation', array());
     }
     $useGlobalElementsPage = false;
     $pages = new Pages();
     if ($pages->isGlobalElementsPageTemplateAvailable()) {
         if ($pages->isGlobalElementsPageAvailable()) {
             $useGlobalElementsPage = true;
         }
     }
     $this->view->assign('useGlobalElementsPage', $useGlobalElementsPage);
     $this->view->assign('globalElementsPageId', $pages->getGlobalElementsPageId());
 }
Пример #3
0
 public function render($args = NULL)
 {
     parent::render($args);
     $this->template->content = $this->pages->where('code', $this->actual)->fetch();
     $this->template->setFile(__DIR__ . "/Page.latte");
     $this->template->render();
 }
 public function indexAction()
 {
     // setup captcha
     if (!$this->view->captcha) {
         $this->view->setVar('captcha', new Captcha\Captcha($this->getDI()->get('config')->recaptcha));
     }
     // get page data
     $pagesTable = new Pages();
     $this->view->setVar(self::PAGE_NAME, $pagesTable->getPageData(self::PAGE_NAME));
     // prepare form
     if (!$this->view->form) {
         $this->view->setVar('form', new \ContactForm\ContactForm());
     }
     if ($this->getDI()->getRequest()->isPost()) {
         $this->view->form = new \ContactForm\ContactForm();
         $newContact = new Contact();
         if ($this->view->form->isValid($this->getDI()->getRequest()->getPost(), $newContact) && $this->view->getVar('captcha')->checkAnswer($this->getDI()->getRequest())) {
             // create new feedback
             $newContact->create();
             // send notification to webmaster
             $newContact->sendFeedbackToAdmin($this->getDI()->get('config'));
             return $this->_forwardContactIndex();
         } else {
             // output error message
             $this->view->setVar('errors', $this->view->form->getMessages());
         }
     }
 }
Пример #5
0
 protected function initPage()
 {
     // If no page id, we have a problem
     $page_id = $this->getRequest()->getParam("pid");
     // If the page does not exist, we have a problem
     $pages = new Pages();
     if ($page = $pages->getPage($page_id)) {
         $this->_page = $page;
     }
     // get the page properties
     if ($page) {
         $this->_page_properties = new PagesProperties(array(PagesProperties::KEY => $page['id']));
         $this->view->page_id = $this->_page['id'];
         $this->view->page_title = $this->_page['title'];
     } else {
         $this->view->page_id = false;
     }
     // Get the tab for further use
     if ($tab = (int) $this->getRequest()->getParam("tab")) {
         $this->view->tab = $tab;
     }
     // Prepare the view
     $this->_helper->layout->setLayoutPath($this->_root . '/application/public/views/layouts/')->setlayout('default');
     $this->view->page_class = $this->_prefix;
 }
Пример #6
0
 public function dellPage($pageId)
 {
     //удалить из таблиц router_contents router_pages
     $pageModel = new Pages($this->dbObject);
     $pageModel->delContent($pageId);
     $pageModel->delPage($pageId);
 }
function smarty_function_pageurl($params, Smarty_Internal_Template $template)
{
    $output = '';
    if (isset($params['page'])) {
        if (isset($params['language'])) {
            $language_id = $params['language'];
        } else {
            $language_id = $template->getTemplateVars('languageId');
            if ($language_id === null) {
                $language_id = Config::get()->languages->standard;
            }
        }
        $mixed_id = $params['page'];
        $page_id = false;
        $pages = new Pages();
        if (is_int($mixed_id)) {
            $page_id = $mixed_id;
        } else {
            if (is_numeric($mixed_id)) {
                $page_id = (int) $mixed_id;
            } else {
                if (is_string($mixed_id)) {
                    $page_id = $pages->getPageIdByUniqueId($mixed_id);
                }
            }
        }
        if ($page_id !== false) {
            $output = $pages->getPageUrl($page_id, $language_id);
        }
    }
    return $output;
}
Пример #8
0
 public function updatetestimonialsAction()
 {
     global $mySession;
     $db = new Db();
     echo $testimonialsId;
     $testimonialsId = $this->getRequest()->getParam('testimonialsId');
     $this->view->testimonialsId = $testimonialsId;
     $this->view->pageHeading = "Edit testimonials";
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $myform = new Form_Testimonials();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             $myObj = new Pages();
             $Result = $myObj->UpdateTestimonials($dataForm, $testimonialsId);
             if ($Result == 1) {
                 $mySession->errorMsg = "testimonials updated successfully.";
                 $this->_redirect('testimonials/index');
             } else {
                 $mySession->errorMsg = "testimonials name you entered already exists.";
                 $this->view->myform = $myform;
                 $this->render('edittestimonials');
             }
         } else {
             $this->view->myform = $myform;
             $this->render('edittestimonials');
         }
     } else {
         $this->_redirect('testimonials/edittestimonials/testimonialsId/' . $testimonialsId);
     }
 }
Пример #9
0
 private function error()
 {
     $path = CONTROLLERS . 'pages_controller.php';
     require_once $path;
     $page = new Pages();
     $params = array('404');
     return $page->load($params, true);
 }
 public function indexAction()
 {
     // enable specific js and css content for only this page
     $this->view->setVar(self::PAGE_NAME, true);
     // get page data from db
     $pagesTable = new Pages();
     $this->view->setVar(self::PAGE_NAME, $pagesTable->getPageData(self::PAGE_NAME));
 }
Пример #11
0
 function szczegolyAction()
 {
     $oRequest = $this->getRequest();
     $iPages = $oRequest->getParam('id');
     $oPages = new Pages();
     $this->view->oPages = $oPages->find($iPages)->current();
     $strony = new Strony();
     $this->view->strony = $strony->fetchAll();
 }
Пример #12
0
 public function defaultAction()
 {
     if (!Auth::isAdmin()) {
         $this->accessDenied();
         return;
     }
     $pages = new Pages();
     $this->view->assign('pagetree', $pages->getChildren());
     $this->view->assign('settings', Settings::getAll());
 }
Пример #13
0
 public function indexAction()
 {
     $tab = (int) $this->getRequest()->getParam("tab");
     $user = Zend_Registry::get('user');
     $pages = new Pages(array(Pages::USER => $user->id));
     $tabs = $pages->getPages();
     if (count($tabs) > 0 && $tab < count($tabs)) {
         $page = $tabs[$tab];
         $this->_forward('index', $page['prefix'], 'pages', array('pid' => $page['id']));
     } else {
         $this->_forward('index', 'nopage', 'pages');
     }
 }
Пример #14
0
 protected function pages()
 {
     $kirby = $this->kirbyInstance();
     $site = $this->siteInstance($kirby);
     $a = $site->find('a');
     $b = $site->find('b');
     $home = $site->find('home');
     $pages = new Pages();
     $pages->add($a);
     $pages->add($b);
     $pages->add($home);
     return $pages;
 }
Пример #15
0
 public function signupAction()
 {
     if (!$this->getRequest()->isPost()) {
         $this->addErrorMessage("Form was not properly posted.");
         $this->_forward('index');
     }
     // Retrieve the form values and its values
     $form = $this->getForm();
     $valid = $form->isValid($_POST);
     $values = $form->getValues();
     $username = $values['username'];
     $email = $values['email'];
     $password = $values['password'];
     // Validate the form itself
     if (!$form->isValid($_POST)) {
         // Failed validation; redisplay form
         $this->view->form = $form;
         $this->addErrorMessage("Your form contains some errors, please correct them and submit this form again");
         return $this->_forward('register');
     }
     // Register user
     $users = new Users();
     $user = $users->addUser($username, $password, $email);
     // Add some default widgets to the user
     $widgets = new Widgets(array(Stuffpress_Db_Table::USER => $user->id));
     $widgets->addWidget('search');
     $widgets->addWidget('rsslink');
     $widgets->addWidget('links');
     $widgets->addWidget('lastcomments');
     $widgets->addWidget('archives');
     $widgets->addWidget('logo');
     // Add some default properties
     $properties = new Properties(array(Stuffpress_Db_Properties::KEY => $user->id));
     $properties->setProperty('theme', 'clouds');
     $properties->setProperty('title', ucfirst($username));
     $properties->setProperty('subtitle', "my life online");
     // Add the storytlr data source
     StuffpressModel::forUser($user->id);
     // Add default pages
     $pages = new Pages(array(Stuffpress_Db_Table::USER => $user->id));
     //$pages->addPage('dashboard', 'Home');
     $pages->addPage('lifestream', 'Stream');
     $pages->addPage('stories', 'Stories');
     // Send the user a verification email
     Stuffpress_Emails::sendWelcomeEmail($email, $username, $password, $user->token);
     // Done !
     $this->view->username = $username;
     $this->view->email = $email;
     $this->render('success');
 }
Пример #16
0
 function indexAction()
 {
     // retrieve the ID of the requested page
     $pageID = $this->view->pageID = $this->_getParam('ID');
     $pageDetails = new PagesIndex();
     $pageDetailsSelect = $pageDetails->select();
     $pageDetailsSelect->where('PI_PageID = ?', $pageID)->where('PI_LanguageID = ?', $this->_defaultEditLanguage);
     $pageDetailsData = $pageDetails->fetchRow($pageDetailsSelect)->toArray();
     $this->view->assign("pageTitle", $pageDetailsData["PI_PageTitle"]);
     $authData = $this->view->user;
     $authID = $authData['EU_ID'];
     if (Cible_FunctionsAdministrators::checkAdministratorPageAccess($authID, $pageID, "data")) {
         $authData = $this->view->user;
         $authID = $authData['EU_ID'];
         if (Cible_FunctionsAdministrators::checkAdministratorPageAccess($authID, $pageID, "structure")) {
             $this->view->assign('hasAccessToStructure', true);
         }
         // Retrieve the page view layout
         $page = new Pages();
         $page_select = $page->select()->setIntegrityCheck(false);
         $page_select->from('Pages')->join('Views', 'Pages.P_ViewID = Views.V_ID')->where('P_ID = ?', $pageID);
         $page_info = Cible_FunctionsPages::getPageViewDetails($pageID);
         $template_file = 'index/' . $page_info['V_Path'];
         $_zone_count = $page_info['V_ZoneCount'];
         // make a request to get all the blocks to be displayed
         $blocks = new Blocks();
         $select = $blocks->select()->setIntegrityCheck(false);
         $select->from('Blocks')->join('Modules', 'Modules.M_ID = Blocks.B_ModuleID')->join('Pages', 'Blocks.B_PageID = P_ID')->join('BlocksIndex', 'Blocks.B_ID = BlocksIndex.BI_BlockID')->where('Blocks.B_PageID = ?', $pageID)->where('BlocksIndex.BI_LanguageID = ?', Zend_Registry::get('languageID'))->order('Blocks.B_Position ASC');
         //Send the results to the view
         $rows = $blocks->fetchAll($select);
         $_blocks = array();
         foreach ($rows as $row) {
             // create the placeholder object if not already defined
             if (!isset($_blocks[$row['B_ZoneID']])) {
                 $_blocks[$row['B_ZoneID']] = array();
             }
             $_blocks[$row['B_ZoneID']][] = $row->toArray();
         }
         $this->view->assign('template_file', $template_file);
         $this->view->assign('zone_count', $_zone_count);
         $this->view->assign('blocks', $_blocks);
         // Load the modules in the view
         $Modules = new Modules();
         $modules = $Modules->fetchAll();
         $this->view->assign('modules', $modules->toArray());
     } else {
         $this->view->assign('template_file', "");
         $this->view->assign('error_message_permission', $this->view->getCibleText('error_message_permission'));
     }
 }
 protected function _List($model, $map = '', $fields = '*', $orderby = 'id desc', $listRows = 0, $pageClass = 'Pages')
 {
     $listRows = $listRows ? $listRows : 10;
     $c_model = clone $model;
     $count = $c_model->where($map)->count('*');
     if ($count > 0) {
         import('ORG.Util.' . $pageClass);
         $Page = new Pages($count, $listRows);
         $nowPage = isset($_GET['p']) ? $_GET['p'] : 1;
         $list = $model->order($orderby)->where($map)->page($nowPage . ',' . $Page->listRows)->select();
         //echo $model->getLastSql();
         $page = $Page->show();
         return array('listinfo' => $list, 'page' => $page, 'result_count' => intval($count));
     }
 }
Пример #18
0
 public function index()
 {
     Cache::loadPage('', 30);
     $inputData = array();
     $postid = 0;
     Model::loadWithPath('page', System::getThemePath() . 'model/');
     if (!($match = Uri::match('page\\/(.*?)\\.html$'))) {
         Redirect::to('404page');
     }
     $friendly_url = addslashes($match[1]);
     $loadData = Pages::get(array('cacheTime' => 30, 'where' => "where friendly_url='{$friendly_url}'"));
     if (!isset($loadData[0]['pageid'])) {
         Redirect::to('404page');
     }
     $inputData = $loadData[0];
     $postid = $loadData[0]['pageid'];
     if (Uri::isNull()) {
         System::setTitle(ucfirst($loadData[0]['title']));
     }
     $keywords = isset($loadData[0]['keywords'][4]) ? $loadData[0]['keywords'] : System::getKeywords();
     System::setKeywords($keywords);
     if ($loadData[0]['page_type'] == 'fullwidth') {
         self::makeContent('pageFullWidth', $inputData);
     } else {
         self::makeContent('page', $inputData);
     }
     Cache::savePage();
 }
Пример #19
0
 public function page($slug = '')
 {
     // allow admin to view unpublished posts
     if (Users::authed() === false) {
         $params['status'] = 'published';
     }
     // if no slug is set we will use our default page
     if (empty($slug)) {
         $params['id'] = Config::get('metadata.home_page');
     } else {
         $params['slug'] = $slug;
     }
     // if we cant find either it looks like we're barney rubble (in trouble)
     if (($page = Pages::find($params)) === false) {
         return Response::error(404);
     }
     // store our page for template functions
     IoC::instance('page', $page, true);
     // does the current page host our posts?
     if ($page->id == Config::get('metadata.posts_page')) {
         // render our posts template
         return Template::render('posts');
     }
     // render our page template
     Template::render('page');
 }
/**
 * Render select page control
 * 
 * Parameters:
 * 
 * - project - Parent project
 * - value - ID of selected page
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_select_page($params, &$smarty)
{
    $project = array_var($params, 'project', null, true);
    if (!instance_of($project, 'Project')) {
        return new InvalidParamError('project', $project, '$project is expected to be an instance of Project class', true);
    }
    // if
    $user = array_var($params, 'user');
    if (!instance_of($user, 'User')) {
        return new InvalidParamError('user', $user, '$user is exepcted to be an instance of User class', true);
    }
    // if
    $options = array();
    $value = array_var($params, 'value', null, true);
    $skip = array_var($params, 'skip');
    $categories = Categories::findByModuleSection($project, PAGES_MODULE, 'pages');
    if (is_foreachable($categories)) {
        foreach ($categories as $category) {
            $option_attributes = $category->getId() == $value ? array('selected' => true) : null;
            $options[] = option_tag($category->getName(), $category->getId(), $option_attributes);
            $pages = Pages::findByCategory($category, STATE_VISIBLE, $user->getVisibility());
            if (is_foreachable($pages)) {
                foreach ($pages as $page) {
                    smarty_function_select_page_populate_options($page, $value, $user, $skip, $options, '- ');
                }
                // foreach
            }
            // if
        }
        // foreach
    }
    // if
    return select_box($options, $params);
}
Пример #21
0
 public function __construct(Request $request)
 {
     $this->request = $request;
     parent::__construct($request);
     // Load the page class
     $this->page = Pages::instance();
 }
Пример #22
0
 /**
  * Постороение дерева
  * @param float $parent id родителя
  * @return array
  */
 public function recursivPages($parent)
 {
     if ($parent == 0) {
         $where = 'IS NULL';
     } else {
         $where = '= ' . $parent;
         $this->tab .= '--';
     }
     $sql = "SELECT * FROM `pages` WHERE `parent` {$where}";
     $pages = DB::parse($sql, true);
     if (isset($pages)) {
         foreach ($pages as $key => $value) {
             if ($parent == 0) {
                 $this->tab = '';
             }
             $listPages .= $this->tab . $value['name'] . '<br>';
             $num = Pages::checkPages($value['pid']);
             if ($num > 0) {
                 $listPages .= Pages::recursivPages($value['pid']);
             }
         }
     }
     $this->tab = substr($this->tab, 2);
     return $listPages;
 }
Пример #23
0
 public function form()
 {
     $this->views = new Views(new Template("admin"));
     Phalanx::loadClasses('Pages');
     $this->views->data = Pages::get($this->get->page_id);
     $this->views->display('pages_form.phtml');
 }
Пример #24
0
 /**
  * Add menu items.
  *
  * @since 3.0.0
  */
 public static function add_menu_items()
 {
     add_submenu_page(self::$main_menu, __('Settings', 'google-calendar-events'), __('Settings', 'google-calendar-events'), 'manage_options', 'simple-calendar_settings', function () {
         $page = new Pages('settings');
         $page->html();
     });
     add_submenu_page(self::$main_menu, __('Add-ons', 'google-calendar-events'), __('Add-ons', 'google-calendar-events'), 'manage_options', 'simple-calendar_add_ons', function () {
         $page = new Pages('add-ons');
         $page->html();
     });
     add_submenu_page(self::$main_menu, __('Tools', 'google-calendar-events'), __('Tools', 'google-calendar-events'), 'manage_options', 'simple-calendar_tools', function () {
         $page = new Pages('tools');
         $page->html();
     });
     do_action('simcal_admin_add_menu_items');
 }
Пример #25
0
 public function run()
 {
     $model = new ProGlobalEnquiry('create');
     $model->country_id = ActiveRecord::getDefaultAreaCode();
     if (isset(Yii::app()->user->id)) {
         $model->name = Yii::app()->user->title . ' ' . Yii::app()->user->first_name . ' ' . Yii::app()->user->last_name;
         $model->email = Yii::app()->user->email;
         if (Yii::app()->user->role_id != ROLE_REGISTER_MEMBER) {
             $model->email = Yii::app()->user->email_not_login;
         }
         $model->phone = Yii::app()->user->phone;
         $model->country_id = Yii::app()->user->country;
     }
     if (isset(Yii::app()->user->id)) {
         $cmsFormater = new CmsFormatter();
         $mUser = Users::model()->findByPk(Yii::app()->user->id);
         $model->name = $cmsFormater->formatFullNameRegisteredUsers($mUser);
         $model->email = $mUser->email;
         $model->nric = $mUser->nric_passportno_roc;
         $model->phone = $mUser->phone;
         if (Yii::app()->user->role_id == ROLE_LANDLORD || Yii::app()->user->role_id == ROLE_TENANT) {
             $model->phone = $mUser->contact_no;
             $model->email = $mUser->email_not_login;
         }
         if (Yii::app()->user->role_id == ROLE_AGENT) {
             $model->email = $mUser->email_not_login;
         }
     }
     //        $model->type_selling= 'Tenancy';
     $box = Pages::getPageById(PAGE_ENGAGE_US_BOX);
     $this->render("global_enquiry", array('model' => $model, 'box' => $box));
 }
Пример #26
0
 function __construct()
 {
     // Call the Controller constructor
     parent::__construct();
     $this->load->library('session');
     $this->load->helper('url');
 }
 /**
  * Create sitemap
  */
 public static function create()
 {
     // Get pages list
     $pages_list = Pages::getPages();
     // Create sitemap content
     $map = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
     $map .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
     foreach ($pages_list as $page) {
         if ($page['parent'] != '') {
             $parent = $page['parent'] . '/';
             $priority = '0.5';
         } else {
             $parent = '';
             $priority = '1.0';
         }
         $map .= "\t" . '<url>' . "\n\t\t" . '<loc>' . Option::get('siteurl') . '/' . $parent . $page['slug'] . '</loc>' . "\n\t\t" . '<lastmod>' . date("Y-m-d", (int) $page['date']) . '</lastmod>' . "\n\t\t" . '<changefreq>weekly</changefreq>' . "\n\t\t" . '<priority>' . $priority . '</priority>' . "\n\t" . '</url>' . "\n";
     }
     // Get list of components
     $components = Sitemap::getComponents();
     // Add components to sitemap
     if (count($components) > 0) {
         foreach ($components as $component) {
             $map .= "\t" . '<url>' . "\n\t\t" . '<loc>' . Option::get('siteurl') . '/' . Text::lowercase($component) . '</loc>' . "\n\t\t" . '<lastmod>' . date("Y-m-d", time()) . '</lastmod>' . "\n\t\t" . '<changefreq>weekly</changefreq>' . "\n\t\t" . '<priority>1.0</priority>' . "\n\t" . '</url>' . "\n";
         }
     }
     // Close sitemap
     $map .= '</urlset>';
     // Save sitemap
     return File::setContent(ROOT . DS . 'sitemap.xml', $map);
 }
Пример #28
0
 /**
  * Constructor.
  *
  * @access protected
  */
 protected function __construct()
 {
     // Init Config
     Config::init();
     // Turn on output buffering
     ob_start();
     // Display Errors
     Config::get('system.errors.display') and error_reporting(-1);
     // Set internal encoding
     function_exists('mb_language') and mb_language('uni');
     function_exists('mb_regex_encoding') and mb_regex_encoding(Config::get('system.charset'));
     function_exists('mb_internal_encoding') and mb_internal_encoding(Config::get('system.charset'));
     // Set default timezone
     date_default_timezone_set(Config::get('system.timezone'));
     // Start the session
     Session::start();
     // Init Cache
     Cache::init();
     // Init Plugins
     Plugins::init();
     // Init Blocks
     Blocks::init();
     // Init Pages
     Pages::init();
     // Flush (send) the output buffer and turn off output buffering
     ob_end_flush();
 }
Пример #29
0
 public static function get_pages($lang = FALSE)
 {
     if ($lang == FALSE) {
         $lang = Settings::get_lang();
     }
     $pages = self::$ci->page_model->get_lang_list(false, $lang);
     // Should never be displayed : no pages are set.
     if (empty($pages)) {
         show_error('Internal error : <b>No pages found.</b><br/>Solution: <b>Create at least one online page.</b>', 500);
         exit;
     }
     /* Spread authorizations from parents pages to chidrens.
      * This adds the group ID to the childrens pages of a protected page
      * If you don't want this, just uncomment this line.
      */
     if (Connect()->logged_in()) {
         self::$user = Connect()->get_current_user();
     }
     self::$ci->page_model->spread_authorizations($pages);
     // Filter pages regarding the authorizations
     $pages = array_values(array_filter($pages, array(__CLASS__, '_filter_pages_authorization')));
     // Set all abolute URLs one time, for perf.
     self::init_absolute_urls($pages, $lang);
     return $pages;
 }
Пример #30
0
 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;
         }
     }
 }