Exemple #1
0
 public function view()
 {
     $c = Page::getByPath('/dashboard/home');
     $v = View::getInstance();
     $v->disableEditing();
     $v->render($c);
 }
Exemple #2
0
 /**
  * Returns a flag for a passed country/region
  */
 public function getFlagIcon($region, $filePathOnly = false)
 {
     $val = \Core::make('helper/validation/strings');
     if ($val->alphanum($region, false, true)) {
         $region = h(strtolower($region));
     } else {
         $region = false;
     }
     if ($region) {
         $v = \View::getInstance();
         if ($v->getThemeDirectory() != '' && file_exists($v->getThemeDirectory() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png')) {
             $icon = $v->getThemePath() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         } elseif (file_exists(DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png')) {
             $icon = REL_DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         } else {
             $icon = ASSETS_URL . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         }
         if (isset($icon)) {
             if ($filePathOnly) {
                 return $icon;
             } else {
                 return '<img class="ccm-region-flag img-responsive" id="ccm-region-flag-' . $region . '" src="' . $icon . '" alt="' . $region . '" />';
             }
         }
     }
 }
Exemple #3
0
	function Area($arHandle) {
		$this->arHandle = $arHandle;
		$v = View::getInstance();
		if (!$v->editingEnabled()) {
			$this->showControls = false;
		}
	}
 public function quickSelect($key, $val = false, $args = array())
 {
     $v = \View::getInstance();
     $v->requireAsset('selectize');
     $form = Loader::helper('form');
     $valt = Loader::helper('validation/token');
     $token = $valt->generate('quick_user_select_' . $key);
     $selectedUID = 0;
     if (isset($_REQUEST[$key])) {
         $selectedUID = $_REQUEST[$key];
     } else {
         if ($val > 0) {
             $selectedUID = $val;
         }
     }
     $uName = '';
     if ($selectedUID > 0) {
         $ui = UserInfo::getByID($selectedUID);
         $uName = $ui->getUserDisplayName();
     }
     $html = "\n\t\t<script type=\"text/javascript\">\n\t\t\$(function () {\n\t\t\t\$('.ccm-quick-user-selector input').unbind().selectize({\n                valueField: 'value',\n                labelField: 'label',\n                searchField: ['label'],";
     if ($val) {
         $html .= "options: [{'label': '" . h($uName) . "', 'value': " . intval($selectedUID) . "}],\n\t\t\t\titems: [" . intval($selectedUID) . "],";
     }
     $html .= "maxItems: 1,\n                load: function(query, callback) {\n                    if (!query.length) return callback();\n                    \$.ajax({\n                        url: '" . REL_DIR_FILES_TOOLS_REQUIRED . "/users/autocomplete?key=" . $key . "&token=" . $token . "&term=' + encodeURIComponent(query),\n                        type: 'GET',\n\t\t\t\t\t\tdataType: 'json',\n                        error: function() {\n                            callback();\n                        },\n                        success: function(res) {\n                            callback(res);\n                        }\n                    });\n                }\n\t\t    });\n\t\t});\n\t\t</script>";
     $html .= '<span class="ccm-quick-user-selector">' . $form->hidden($key, '', $args) . '</span>';
     return $html;
 }
Exemple #5
0
 public function __construct()
 {
     parent::__construct();
     $this->_form = new BookingForm();
     $this->_bookingModel = BookingModel::getInstance();
     $this->_view = View::getInstance();
 }
 public function handleRequest()
 {
     $registry = SessionRegistry::getInstance();
     $cmdHnd = CommandHandler::getInstance();
     $cmd = $cmdHnd->getCommand($registry);
     $cmd->execute($registry, View::getInstance($registry));
 }
Exemple #7
0
 public function registerViewAssets()
 {
     $al = \AssetList::getInstance();
     $v = \View::getInstance();
     $env = \Environment::get();
     $identifier = 'menuitem/' . $this->menuItem->getHandle() . '/view';
     foreach (array('CSS' => 'view.css', 'JAVASCRIPT' => 'view.js') as $t => $i) {
         $r = $env->getRecord(DIRNAME_MENU_ITEMS . '/' . $this->menuItem->getHandle() . '/' . $i, $this->menuItem->getPackageHandle());
         if ($r->exists()) {
             switch ($t) {
                 case 'CSS':
                     $asset = new CssAsset($identifier);
                     $asset->setAssetURL($r->url);
                     $asset->setAssetPath($r->file);
                     $al->registerAsset($asset);
                     $v->requireAsset('css', $identifier);
                     break;
                 case 'JAVASCRIPT':
                     $asset = new JavascriptAsset($identifier);
                     $asset->setAssetURL($r->url);
                     $asset->setAssetPath($r->file);
                     $al->registerAsset($asset);
                     $v->requireAsset('javascript', $identifier);
                     break;
             }
         }
     }
 }
Exemple #8
0
    /**
     * Creates form fields and JavaScript page chooser for choosing a page. For use with inclusion in blocks.
     * <code>
     *     $dh->selectPage('pageID', '1'); // prints out the home page and makes it selectable.
     * </code>
     *
     * @param $fieldName
     * @param bool|int $cID
     * @return string
     */
    public function selectPage($fieldName, $cID = false)
    {
        $v = \View::getInstance();
        $v->requireAsset('core/sitemap');
        $selectedCID = 0;
        if (isset($_REQUEST[$fieldName])) {
            $selectedCID = intval($_REQUEST[$fieldName]);
        } else {
            if ($cID > 0) {
                $selectedCID = $cID;
            }
        }
        if ($selectedCID) {
            $args = "{'inputName': '{$fieldName}', 'cID': {$selectedCID}}";
        } else {
            $args = "{'inputName': '{$fieldName}'}";
        }
        $identifier = new \Concrete\Core\Utility\Service\Identifier();
        $identifier = $identifier->getString(32);
        $html = <<<EOL
        <div data-page-selector="{$identifier}"></div>
        <script type="text/javascript">
        \$(function() {
            \$('[data-page-selector={$identifier}]').concretePageSelector({$args});
        });
        </script>
EOL;
        return $html;
    }
Exemple #9
0
 public function __construct()
 {
     $this->_view = View::getInstance();
     $this->_request = Request::getInstance();
     $this->_validator = Validator::getInstance();
     $this->_translator = Translator::getInstance();
 }
 public function on_start()
 {
     $c = Page::getByPath('/dashboard/blocks/stacks');
     $cp = new Permissions($c);
     if ($cp->canViewPage()) {
         $c = Page::getCurrentPage();
         $pcp = new Permissions($c);
         if (!$pcp->canViewPageVersions() || $_GET['vtask'] != 'view_versions' && $_GET['vtask'] != 'compare') {
             $cID = $c->getCollectionID();
             $this->redirect('/dashboard/blocks/stacks', 'view_details', $cID);
         } else {
             $this->theme = 'dashboard';
         }
     } else {
         global $c;
         // ugh
         $v = View::getInstance();
         $c = new Page();
         $c->loadError(COLLECTION_NOT_FOUND);
         $v->setCollectionObject($c);
         $this->c = $c;
         $cont = Loader::controller("/page_not_found");
         $v->setController($cont);
         $v->render('/page_not_found');
     }
 }
Exemple #11
0
 /**
  * Returns a flag for a passed country/region.
  */
 public static function getFlagIcon($region, $filePathOnly = false)
 {
     $val = \Core::make('helper/validation/strings');
     if ($val->alphanum($region, false, true)) {
         $region = h(strtolower($region));
     } else {
         $region = false;
     }
     if ($region) {
         $v = \View::getInstance();
         if ($v->getThemeDirectory() != '' && file_exists($v->getThemeDirectory() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png')) {
             $icon = $v->getThemePath() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         } elseif (file_exists(DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png')) {
             $icon = REL_DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         } else {
             $icon = ASSETS_URL . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
         }
         if (isset($icon)) {
             if ($filePathOnly) {
                 return $icon;
             } else {
                 $img = new Image($icon, $region, ['id' => 'ccm-region-flag-' . $region, 'class' => 'ccm-region-flag']);
                 return $img;
             }
         }
     }
 }
Exemple #12
0
	public function view_details($cID, $msg = false) {
		$s = Stack::getByID($cID);
		if (is_object($s)) {
			$blocks = $s->getBlocks('Main');
			$view = View::getInstance();
			foreach($blocks as $b1) {
				$btc = $b1->getInstance();
				// now we inject any custom template CSS and JavaScript into the header
				if('Controller' != get_class($btc)){
					$btc->outputAutoHeaderItems();
				}
				$btc->runTask('on_page_view', array($view));
			}
			$this->addHeaderItem('<style type="text/css">' . $s->outputCustomStyleHeaderItems(true) . '</style>');

			$this->set('stack', $s);
			$this->set('blocks', $blocks);
			switch($msg) {
				case 'delete_saved':
					$this->set('message', t('Delete request saved. You must complete the delete workflow before this stack can be deleted.'));
					break;
			
			}
		} else {
			throw new Exception(t('Invalid stack'));
		}
	}
 public function __construct()
 {
     $this->app = App::getInstance();
     $this->config = $this->app->getConfig();
     $this->view = View::getInstance();
     $this->input = InputData::getInstance();
 }
Exemple #14
0
 /**
  * @param $option
  */
 public function __construct($option = "")
 {
     $this->view = View::getInstance();
     if ($option && is_callable([$this, $option])) {
         $this->{$option}();
     }
 }
Exemple #15
0
 /**
  * Factory for fetching the Presenter
  *
  * @param string  $view
  * @param string  $method
  * @param boolean $autoFilter
  * @param string  $view
  *
  * @return \Fuel\Display\Presenter
  *
  * @throws \RuntimeException if the the presenter class could not be loaded
  */
 public static function forge($uri, $method = 'view', $autoFilter = true, $view = null)
 {
     // was a custom view string passed?
     if ($view === null) {
         $view = $uri;
     }
     // get the current request namespace
     $currentNamespace = \Request::getInstance()->getRoute()->namespace;
     // pop the last one off, and add the Presenter namespace
     $currentNamespace = explode('\\', $currentNamespace);
     end($currentNamespace);
     $currentNamespace[key($currentNamespace)] = 'Presenter';
     $currentNamespace = implode('\\', $currentNamespace);
     // get the segments from the presenter string passed
     $segments = explode('/', $uri);
     while (count($segments)) {
         $class = $currentNamespace . '\\' . implode('\\', array_map('ucfirst', $segments));
         if (class_exists($class)) {
             $presenter = new $class(\View::getInstance(), $method, $autoFilter, $view);
             break;
         }
         array_pop($segments);
     }
     // bail out if the presenter class could not be loaded
     if (!isset($presenter)) {
         throw new \RuntimeException('FOU-012: Presenter class identified by [' . $uri . '] could not be found.');
     } elseif (!$presenter instanceof \Fuel\Display\Presenter) {
         throw new \RuntimeException('FOU-013: Presenter class [' . get_class($presenter) . '] does not extend "Fuel\\Display\\Presenter".');
     }
     return $presenter;
 }
Exemple #16
0
 private function init()
 {
     $this->session = Session::getInstance();
     $this->request = Request::getInstance();
     $this->router = Router::getInstance();
     $this->view = View::getInstance();
 }
Exemple #17
0
 /**
 +----------------------------------------------------------
 * 架构函数 取得模板对象实例
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 */
 public function __construct()
 {
     //实例化视图类
     $this->view = View::getInstance();
     $this->name = $this->getActionName();
     //控制器初始化
     $this->_initialize();
 }
 /**
 +----------------------------------------------------------
 * 架构函数 取得模板对象实例
 +----------------------------------------------------------
 * @access public 
 +----------------------------------------------------------
 */
 public function __construct()
 {
     //实例化模板类
     $this->tpl = View::getInstance();
     $this->name = substr(get_class($this), 0, -6);
     //控制器初始化
     $this->_initialize();
 }
Exemple #19
0
 /**
  * 创建view层
  */
 protected function _createView()
 {
     $this->_loadCore('View');
     $this->_view = View::getInstance();
     $rbac = $this->_getGlobalData('Util_Rbac', 'object');
     $this->_view->assign('rbac', $rbac);
     $this->_view->assign('noData', '暂无数据');
 }
 /**
  *
  */
 public function __construct()
 {
     $this->View = View::getInstance();
     $this->Model = Router::getRoute()['Controller'];
     $this->loadModel($this->Model);
     $this->Request = Request::getInstance();
     $this->Session = Session::getInstance();
     Orm::getInstance();
 }
 /**
  * Tests getting the name using Mediator class accessor method.
  */
 public function testViewAccessor()
 {
     // Create a view object
     $view = View::getInstance('testView');
     // Create a new Mediator and use accessors to set the mediator name
     $mediator = new Mediator(Mediator::NAME, $view);
     // test assertions
     $this->assertNotNull($mediator->getViewComponent(), "Expecting mediator.getViewComponent() not null");
 }
 /**
 +----------------------------------------------------------
 * 架构函数 取得模板对象实例
 +----------------------------------------------------------
 * @author Fantasy制作,Nonant修改,SamPeng重构
 * @access public
 +----------------------------------------------------------
 */
 public function __construct()
 {
     $this->view = View::getInstance();
     $this->name = substr(get_class($this), 0, -6);
     $this->init();
     if (method_exists($this, '_initialize')) {
         $this->_initialize();
     }
 }
 public function init($selector = '.ccm-overlay')
 {
     $view = View::getInstance();
     $v = View::getInstance();
     $v->requireAsset('core/lightbox');
     if ($selector && strlen($selector)) {
         $js = "<script type=\"text/javascript\">\$(function() {\n\t\t\t\t\$('" . $selector . "-image').magnificPopup({type:'image'});\n\t\t\t\t\$('" . $selector . "-iframe').magnificPopup({type:'image'});\n\t\t\t\t\$('" . $selector . "-inline').magnificPopup({type:'image'});\n\t\t\t\t\$('" . $selector . "-ajax').magnificPopup({type:'image'});\n\t\t\t});</script>";
         $view->addFooterItem($js);
     }
 }
 public function on_load_page()
 {
     require_once dirname(__FILE__) . DS . 'view.php';
     $page = $_REQUEST['page'];
     list($page_prefix, $type) = explode('.', $page);
     $view = View::getInstance($type, $this->_prefix . 'View');
     if (method_exists($view, 'on_load_page')) {
         $view->on_load_page();
     }
 }
Exemple #25
0
 public function addMetaTags($v = NULL)
 {
     if (!$v instanceof View) {
         $v = View::getInstance();
     }
     $translations = self::getTranslatedPages();
     foreach ($translations as $locale => $tpage) {
         $v->addHeaderItem(self::altMeta($locale, $tpage));
     }
 }
 /**
  *
  */
 public function getView($type, $prefix = '', $config = '')
 {
     require_once 'view.php';
     if (!$prefix) {
         $class = get_class($this);
         $t = explode('Controller', $class);
         $prefix = $t[0] . 'View';
     }
     $view = View::getInstance($type, $prefix, $config);
     return $view;
 }
Exemple #27
0
 /**
  * Loads an element from C5 or the site
  */
 public function element($_file, $args = null, $_pkgHandle = null)
 {
     if (is_array($args)) {
         $collisions = array_intersect(array('_file', '_pkgHandle'), array_keys($args));
         if ($collisions) {
             throw new Exception(t("Illegal variable name '%s' in element args.", implode(', ', $collisions)));
         }
         $collisions = null;
     }
     View::getInstance()->includeFileInScope(Environment::get()->getPath(DIRNAME_ELEMENTS . '/' . $_file . '.php', $_pkgHandle), (array) $args);
 }
Exemple #28
0
	public function view() {
		$v = View::getInstance();
		$c = $v->getCollectionObject();
		if (is_object($c)) {
			$cID = $c->getCollectionID();
			if($cID) { 
				$this->forward($cID); // set the intended url
			}
		}
		parent::view();
		$this->render('/login');
	}
 public function __construct()
 {
     $this->view = View::getInstance();
     $this->name = $this->getActionName();
     if ($this->isGet()) {
         if (C('ACTION_CACHE_ON') && in_array(ACTION_NAME, $this->_cacheAction, true)) {
             $content = S(md5(__SELF__));
             if ($content) {
                 echo $content;
                 exit;
             }
         }
     }
     $this->_initialize();
 }
Exemple #30
0
 public function on_start()
 {
     //		stuff here will run on every page request before anything else.
     //		if full page cache is turned on, this will not run on cached pages
     //
     //		events are the most common use case
     //		for more details on events, check out the documentation here:
     //		http://www.concrete5.org/documentation/developers/system/events
     //
     Events::extendPageType('boilerplate', 'on_page_add');
     $html = Loader::helper("html");
     $v = View::getInstance();
     $v->addHeaderItem($html->css("boilerplate.css", "c5_boilerplate"));
     $v->addHeaderItem($html->javascript("boilerplate.js", "c5_boilerplate"));
 }