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


PHP Resource::getInstance方法代码示例

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


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

示例1: indexAction

 public function indexAction()
 {
     $version = Config::factory(Config::File_Array, $this->_configMain['configs'] . 'versions.php')->get('orm');
     $res = Resource::getInstance();
     $dbConfigs = array();
     foreach ($this->_configMain->get('db_configs') as $k => $v) {
         $dbConfigs[] = array('id' => $k, 'title' => $this->_lang->get($v['title']));
     }
     //tooltips
     $lPath = $this->_configMain->get('lang_path') . $this->_configMain->get('language') . '/orm.php';
     Lang::addDictionaryLoader('orm_tooltips', $lPath, Config::File_Array);
     $this->_resource->addInlineJs('
       var canPublish =  ' . (int) $this->_user->canPublish($this->_module) . ';
       var canEdit = ' . (int) $this->_user->canEdit($this->_module) . ';
       var canDelete = ' . (int) $this->_user->canDelete($this->_module) . ';
       var useForeignKeys = ' . (int) $this->_configMain['foreign_keys'] . ';
       var canUseBackup = ' . (int) $this->_isLocalhost() . ';
       var dbConfigsList = ' . json_encode($dbConfigs) . ';
     ');
     $this->_resource->addRawJs('var ormTooltips = ' . Lang::lang('orm_tooltips')->getJson() . ';');
     $res->addJs('/js/app/system/SearchPanel.js', 0);
     $res->addJs('/js/app/system/ORM.js?v=' . $version, 2);
     $res->addJs('/js/app/system/EditWindow.js', 1);
     $res->addJs('/js/app/system/HistoryPanel.js', 1);
     $res->addJs('/js/app/system/ContentWindow.js', 1);
     $res->addJs('/js/app/system/RevisionPanel.js', 2);
     $res->addJs('/js/app/system/RelatedGridPanel.js', 2);
     $res->addJs('/js/lib/uml/raphael.js', 3);
     // $res->addJs('/js/lib/uml/raphael.2.1.min.js'  , 3);
     $res->addJs('/js/lib/uml/joint.js', 4);
     $res->addJs('/js/lib/uml/joint.dia.js', 5);
     $res->addJs('/js/lib/uml/joint.dia.uml.js', 6);
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:33,代码来源:Controller.php

示例2: loginAction

 /**
  * Show login form
  */
 protected function loginAction()
 {
     $template = new Template();
     $template->set('wwwRoot', $this->_configMain->get('wwwroot'));
     $template->resource = Resource::getInstance();
     Response::put($template->render('./templates/public/backoffice_login.php'));
     Application::close();
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:11,代码来源:Authorised.php

示例3: __construct

 public function __construct()
 {
     $this->_page = Page::getInstance();
     $this->_resource = Resource::getInstance();
     $this->_lang = Lang::lang();
     $this->_db = static::$_defaultDb;
     $this->_configMain = Registry::get('main', 'config');
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:8,代码来源:Controller.php

示例4: actionEdit

 public function actionEdit($type = false)
 {
     $cid = Request::getVar('cid', "");
     if (is_array($cid)) {
         $cid = $cid[0];
     }
     setSysConfig("sidebar.display", 0);
     $this->addIconToolbar("Save", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'save')), "save");
     $this->addIconToolbar("Apply", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'apply')), "apply");
     $this->addBarTitle("Permission <small>[Edit]</small>", "user");
     $this->addIconToolbar("Close", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'cancel')), "cancel");
     $this->pageTitle = "Edit resource";
     $model = Resource::getInstance();
     $item = $model->getItem($cid);
     $data['lists'] = $model->getListEdit($item);
     $data['item'] = $item;
     $this->render('edit', $data);
 }
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:18,代码来源:resourceController.php

示例5: actionGrant

 function actionGrant()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to visit page");
         $this->redirect(Router::buildLink("cpanel"));
     }
     global $user;
     $cid = Request::getVar('cid', 0);
     $obj_user = YiiUser::getInstance();
     $obj_user = $obj_user->getUser($cid);
     $this->addBarTitle("Grant user <small>[{$obj_user->username}]</small>", "user");
     $this->addIconToolbar("Save", Router::buildLink("permission", array('view' => 'users', 'layout' => 'save')), "save");
     $this->addIconToolbar("Apply", Router::buildLink("permission", array('view' => 'users', 'layout' => 'apply')), "apply");
     $this->addIconToolbar("Close", Router::buildLink("permission", array('view' => 'users', 'layout' => 'cancel')), "cancel");
     $this->pageTitle = "Edit grant";
     $model_resource = Resource::getInstance();
     $model = Users::getInstance();
     $items = $model_resource->getItems();
     $all_granted = $model->getGranted();
     $lists = $model->getListGrant();
     $this->render('grant', array("items" => $items, "all_granted" => $all_granted, "lists" => $lists));
 }
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:23,代码来源:UsersController.php

示例6: __construct

 public function __construct()
 {
     $this->_page = Page::getInstance();
     $this->_resource = Resource::getInstance();
     $this->_module = $this->getModule();
     $this->_lang = Lang::lang();
     $this->_db = static::$_defaultDb;
     $this->_configMain = Registry::get('main', 'config');
     $cacheManager = new Cache_Manager();
     $this->_configBackoffice = Config::factory(Config::File_Array, $this->_configMain->get('configs') . 'backend.php');
     $this->_cache = $cacheManager->get('data');
     if (Request::get('logout', 'boolean', false)) {
         User::getInstance()->logout();
         session_destroy();
         if (!Request::isAjax()) {
             Response::redirect(Request::url(array('index')));
         }
     }
     $this->checkAuth();
     if ($this->_configBackoffice->get('use_csrf_token')) {
         $csrf = new Security_Csrf();
         $this->_page->csrfToken = $csrf->createToken();
     }
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:24,代码来源:Backoffice.php

示例7: showPage

 /**
  * Show Page.
  * Running this method initiates rendering of templates and sending of HTML
  * data.
  *
  * @param Page $page
  * @param Blockmanager $blockManager
  */
 public function showPage(Page $page, Blockmanager $blockManager)
 {
     header('Content-Type: text/html; charset=utf-8');
     $template = new Template();
     $template->disableCache();
     $template->setProperties(array('development' => $this->_appConfig->get('development'), 'page' => $page, 'path' => $page->getThemePath(), 'templatesRoot' => Application::getTemplatesPath(), 'blockManager' => $blockManager, 'resource' => Resource::getInstance(), 'pagesTree' => Model::factory('Page')->getTree()));
     Response::put($template->render($page->getTemplatePath('layout.php')));
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:16,代码来源:Router.php

示例8: _compileItem

 /**
  * Conpile object
  * @param string $id
  * @return array()
  */
 protected function _compileItem($id)
 {
     $object = $this->_project->getObject($id);
     if ($object->getClass() === 'Component_Field_System_Medialibhtml') {
         /**
          * @todo Уменьшить связанность
          */
         Resource::getInstance()->addJs('/js/lib/jquery.js', 1);
         Model::factory('Medialib')->includeScripts();
     }
     $code = array('defines' => '', 'layout' => '');
     $code = $this->_compileJs($id);
     $definesCode = $code['defines'];
     $layoutCode = $code['layout'];
     $layoutCode .= $this->getObjectLayoutCode($id);
     return array('layout' => $layoutCode, 'defines' => $definesCode);
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:22,代码来源:Code.php

示例9: runProject

    /**
     * Init layout from designer project
     * @property string $projectFile - designer project related path
     * @property Config_Abstract $designerConfig
     * @property array $replaceTemplates, optional
     * @todo cache the code
     */
    public static function runProject($projectFile, Config_Abstract $designerConfig, $replace = array(), $renderTo = false)
    {
        /**
         * @todo slow operation
         */
        if (!file_exists($projectFile)) {
            throw new Exception('Invalid project file' . $projectFile);
        }
        /**
         * @todo slow operation
         */
        $cachedKey = self::getProjectCacheKey($projectFile);
        $project = Designer_Factory::loadProject($designerConfig, $projectFile);
        $projectCfg = $project->getConfig();
        Ext_Code::setRunNamespace($projectCfg['runnamespace']);
        $projectData['includes'] = self::getProjectIncludes($cachedKey, $project, true, $replace);
        $names = $project->getRootPanels();
        $actionJs = $project->getActionsFile();
        $initCode = '
		    var applicationClassesNamespace = "' . $projectCfg['namespace'] . '";
			var applicationRunNamespace = "' . $projectCfg['runnamespace'] . '";
		';
        $initCode .= 'Ext.onReady(function(){';
        if (!empty($names)) {
            if ($renderTo) {
                $renderTo = str_replace('-', '_', $renderTo);
                $initCode .= '
				app.content = Ext.create("Ext.container.Container", {
					layout:"fit",
					renderTo:"' . $renderTo . '"
				});
      		   ';
            }
            foreach ($names as $name) {
                if ($project->getObject($name)->isExtendedComponent()) {
                    if ($project->getObject($name)->getConfig()->defineOnly) {
                        continue;
                    }
                    $initCode .= Ext_Code::appendRunNamespace($name) . ' = Ext.create("' . Ext_Code::appendNamespace($name) . '",{});';
                }
                $initCode .= '
					app.content.add(' . Ext_Code::appendRunNamespace($name) . ');
				';
            }
            if ($renderTo) {
                $initCode .= '
			      	app.content.doComponentLayout();
				';
            }
        }
        $initCode .= '
		              app.application.fireEvent("projectLoaded");
	           });';
        $resource = Resource::getInstance();
        if ($projectData && isset($projectData['includes']) && !empty($projectData['includes'])) {
            foreach ($projectData['includes'] as $file) {
                if (File::getExt($file) == '.css') {
                    if (strpos($file, '?') === false) {
                        $file = $file . '?' . $cachedKey;
                    }
                    $resource->addCss($file, false);
                } else {
                    if (strpos($file, '?') === false) {
                        $file = $file . '?' . $cachedKey;
                    }
                    $resource->addJs($file, false, false);
                }
            }
        }
        $resource->addInlineJs($initCode);
    }
开发者ID:vgrish,项目名称:dvelum,代码行数:78,代码来源:Factory.php

示例10: actionEdit

 public function actionEdit()
 {
     global $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to add/edit group");
         $this->redirect(Router::buildLink("users", array('view' => 'group')));
     }
     setSysConfig("sidebar.display", 0);
     $this->addIconToolbar("Save", Router::buildLink("users", array("view" => "group", "layout" => "save")), "save");
     $this->addIconToolbar("Apply", Router::buildLink("users", array("view" => "group", "layout" => "apply")), "apply");
     $items = array();
     $cid = Request::getVar("cid", 0);
     if (is_array($cid)) {
         $cid = $cid[0];
     }
     if ($cid == 0) {
         $this->addIconToolbar("Cancel", Router::buildLink("users", array("view" => "group", "layout" => "cancel")), "cancel");
         $this->addBarTitle("User group <small>[New]</small>", "user");
         $this->pageTitle = "New group";
     } else {
         $this->addIconToolbar("Close", Router::buildLink("users", array("view" => "group", "layout" => "cancel")), "cancel");
         $this->addBarTitle("User group <small>[Edit]</small>", "user");
         $this->pageTitle = "Edit group";
     }
     $model = new Group();
     $model_resource = Resource::getInstance();
     $item = $model->getItem();
     $lists = $model->getListEdit($item);
     $arr_resource = $model_resource->getItems();
     $all_granted = $model->getGranted();
     $this->render('edit', array("item" => $item, "lists" => $lists, 'arr_resource' => $arr_resource, "all_granted" => $all_granted));
 }
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:32,代码来源:GroupController.php

示例11:

<?php

if (!defined('DVELUM')) {
    exit;
}
$page = $this->get('page');
$resource = Resource::getInstance();
$resource->addCss('/templates/public/main/css/reset.css', 0);
$resource->addCss('/templates/public/main/css/style.css', 100);
$wwwRoot = Request::wwwRoot();
?>
<!DOCTYPE html>
<html>
<head>
	<title><?php 
echo $page->html_title;
?>
</title>
	<?php 
/*<BASE href="<?php echo Request::baseUrl();?>">*/
$page = $this->get('page');
echo $page->getOgMeta();
if (isset($page->csrfToken) && !empty($page->csrfToken)) {
    echo '<meta name="csrf-token" content="' . $page->csrfToken . '"/>';
}
if (strlen($page->meta_description)) {
    echo '	<meta name="DESCRIPTION" content="' . $page->meta_description . '" />' . "\n";
}
if (strlen($page->meta_keywords)) {
    echo '	<meta name="KEYWORDS" content="' . $page->meta_keywords . '" />';
}
开发者ID:vgrish,项目名称:dvelum,代码行数:31,代码来源:header.php

示例12: Template

		 <div class="block_wrap feature_wrap">
			 <div class="bottom elements">
				 <div class="layout-wrap sidebar-right">
					<div class="content-wrap">
						<div id="content" class="content">
						   <h3><?php 
echo $page->page_title;
?>
</h3>
						   <?php 
echo $page->text;
?>
						</div>
						<div class="sep"></div>
					</div>
					<div id="sidebar">
						<?php 
echo $this->get('blockManager')->getBlocksHtml('rightblocks');
?>
					</div>
				 </div>	
			 </div>
		 </div>
	</div><!--end:fullwidth-->
</div><!--end:container-->
<?php 
$template = new Template();
$template->set('page', Page::getInstance());
$template->set('resource', Resource::getInstance());
$template->set('bottomBlocks', $this->get('blockManager')->getBlocksHtml('bottomblocks'));
echo $template->render($this->path . '/footer.php');
开发者ID:vgrish,项目名称:dvelum,代码行数:31,代码来源:layout.php

示例13: includeScripts

 /**
  * Include required JavaScript files defined in the configuration file
  */
 public function includeScripts()
 {
     $resource = Resource::getInstance();
     $media = Model::factory('Medialib');
     $media->includeScripts();
     $includesPath = $this->configMain->get('configs') . 'js_inc_backend.php';
     $cfg = Config::factory(Config::File_Array, $includesPath);
     $resource->addJs('/js/lib/jquery.js', 0, true, 'head');
     if ($this->configMain->get('development')) {
         $resource->addJs('/js/lib/extjs4/ext-all-debug.js', 0, true, 'head');
     } else {
         $resource->addJs('/js/lib/extjs4/ext-all.js', 0, true, 'head');
     }
     $resource->addJs('/js/lang/' . $this->configMain['language'] . '.js', 1, true, 'head');
     $resource->addJs('/js/lib/extjs4/locale/ext-lang-' . $this->configMain['language'] . '.js', 2, true, 'head');
     $resource->addJs('/js/app/system/common.js', 3, false, 'head');
     $resource->addJs('/js/lib/extjs4/ext-theme-gray.js', 2);
     $resource->addCss('/js/lib/extjs4/resources/css/ext-all-gray.css');
     $resource->addCss('/templates/system/default/css/style.css');
     if ($cfg->getCount()) {
         $js = $cfg->get('js');
         if (!empty($js)) {
             foreach ($js as $file => $config) {
                 $resource->addJs($file, $config['order'], $config['minified']);
             }
         }
         $css = $cfg->get('css');
         if (!empty($css)) {
             foreach ($css as $file => $config) {
                 $resource->addCss($file, $config['order']);
             }
         }
     }
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:37,代码来源:Controller.php

示例14: actionEdit

 function actionEdit()
 {
     global $user;
     setSysConfig("sidebar.display", 0);
     $model = new Users();
     $cid = Request::getVar("cid", 0);
     if (is_array($cid)) {
         $cid = $cid[0];
     }
     $this->addIconToolbar("Save", Router::buildLink("users", array("view" => "user", 'layout' => 'save')), "save");
     $this->addIconToolbar("Apply", Router::buildLink("users", array("view" => "user", 'layout' => 'apply')), "apply");
     if ($cid == 0) {
         $this->addIconToolbar("Cancel", Router::buildLink("users", array("view" => "user", 'layout' => 'cancel')), "cancel");
         $this->addBarTitle("User <small>[New]</small>", "user");
         $this->pageTitle = "New User";
     } else {
         $this->addIconToolbar("Close", Router::buildLink("users", array("view" => "user", 'layout' => 'cancel')), "cancel");
         $this->addBarTitle("User <small>[Edit]</small>", "user");
         $this->pageTitle = "Edit User";
     }
     $model = new Users();
     $model_resource = Resource::getInstance();
     $item = $model->getItem($cid);
     if ($item->id != 0) {
         // account da duoc tao
         if (!($bool = $user->modifyChecking($item->id))) {
             // user leader nhom cha
             if ($item->status != -1) {
                 // user da duoc active thi khong duoc thay doi
                 YiiMessage::raseNotice("Your account not have permission to modify this account");
                 $this->redirect(Router::buildLink("cpanel"));
             }
         }
         // => user da active thi chi user do va superadmin moi thay doi thong tin
     } else {
         if ($user->leader == 0) {
             // neu khong phai leader thi khong duoc tao acc moi
             YiiMessage::raseNotice("Your account not have permission to make account");
             $this->redirect(Router::buildLink("cpanel"));
         }
     }
     $arr_resource = $model_resource->getItems();
     $all_granted = $model->getGranted();
     $lists = $model->getListEdit($item);
     $this->render('edit', array("item" => $item, "lists" => $lists, 'arr_resource' => $arr_resource, "all_granted" => $all_granted));
 }
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:46,代码来源:UserController.php

示例15: includeScripts

 /**
  * Include required sources
  */
 public function includeScripts()
 {
     $version = Config::factory(Config::File_Array, Registry::get('main', 'config')->get('configs') . 'versions.php')->get('medialib');
     if (self::$_scriptsIncluded) {
         return;
     }
     $conf = $this->getConfig()->__toArray();
     $resource = Resource::getInstance();
     $resource->addCss('/js/lib/jquery.Jcrop.css');
     $editor = Registry::get('main', 'config')->get('html_editor');
     if ($editor === 'tinymce') {
         $resource->addJs('/js/lib/tiny_mce/tiny_mce.js', 0, true);
         $resource->addJs('/js/lib/ext_ux/Ext.ux.TinyMCE.js', 1, true);
         $resource->addJs('/js/app/system/medialib/HtmlPanel_tinymce.js', 3);
     } elseif ($editor === 'ckeditor') {
         $resource->addJs('/js/lib/ckeditor/ckeditor.js', 0, true);
         $resource->addJs('/js/lib/ext_ux/ckplugin.js', 1, true);
         $resource->addJs('/js/app/system/medialib/HtmlPanel_ckeditor.js', 3);
     }
     $resource->addJs('/js/lib/ext_ux/AjaxFileUpload.js', 1, false);
     $resource->addJs('/js/app/system/SearchPanel.js', 1);
     $resource->addJs('/js/app/system/ImageField.js', 1);
     $resource->addJs('/js/app/system/MedialinkField.js', 1);
     $resource->addJs('/js/app/system/Medialib.js?v=' . $version, 2);
     $resource->addJs('/js/lib/jquery.Jcrop.min.js', 2, true);
     $resource->addInlineJs('
   	app.maxFileSize = "' . ini_get('upload_max_filesize') . '";
   	app.mediaConfig = ' . json_encode($conf) . ';
   	app.imageSize = ' . json_encode($conf['image']['sizes']) . ';
   	app.medialibControllerName = "medialib";
 ');
     self::$_scriptsIncluded = true;
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:36,代码来源:Medialib.php


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