本文整理汇总了PHP中View::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP View::getInstance方法的具体用法?PHP View::getInstance怎么用?PHP View::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view()
{
$c = Page::getByPath('/dashboard/home');
$v = View::getInstance();
$v->disableEditing();
$v->render($c);
}
示例2: getFlagIcon
/**
* 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 . '" />';
}
}
}
}
示例3: Area
function Area($arHandle) {
$this->arHandle = $arHandle;
$v = View::getInstance();
if (!$v->editingEnabled()) {
$this->showControls = false;
}
}
示例4: quickSelect
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;
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->_form = new BookingForm();
$this->_bookingModel = BookingModel::getInstance();
$this->_view = View::getInstance();
}
示例6: handleRequest
public function handleRequest()
{
$registry = SessionRegistry::getInstance();
$cmdHnd = CommandHandler::getInstance();
$cmd = $cmdHnd->getCommand($registry);
$cmd->execute($registry, View::getInstance($registry));
}
示例7: registerViewAssets
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;
}
}
}
}
示例8: selectPage
/**
* 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;
}
示例9: __construct
public function __construct()
{
$this->_view = View::getInstance();
$this->_request = Request::getInstance();
$this->_validator = Validator::getInstance();
$this->_translator = Translator::getInstance();
}
示例10: on_start
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');
}
}
示例11: getFlagIcon
/**
* 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;
}
}
}
}
示例12: view_details
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'));
}
}
示例13: __construct
public function __construct()
{
$this->app = App::getInstance();
$this->config = $this->app->getConfig();
$this->view = View::getInstance();
$this->input = InputData::getInstance();
}
示例14: __construct
/**
* @param $option
*/
public function __construct($option = "")
{
$this->view = View::getInstance();
if ($option && is_callable([$this, $option])) {
$this->{$option}();
}
}
示例15: forge
/**
* 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;
}