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


PHP modResource::getProperties方法代码示例

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


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

示例1: getProperties

 /**
  * Override the parent function to get our special properties.
  * @param string $namespace
  * @return array
  */
 public function getProperties($namespace = 'core')
 {
     $properties = parent::getProperties($namespace);
     //$this->xpdo->log(1, print_r($properties,true));
     if (!empty($properties)) {
         return $properties;
     }
     // Properties defaults
     $properties = array('product_type' => 'regular', 'product_template' => $this->xpdo->getOption('moxycart.default_product_template', '', $this->xpdo->getOption('default_template')), 'sort_order' => 'name', 'qty_alert' => 0, 'track_inventory' => 0, 'specs' => array(), 'variations' => array(), 'taxonomies' => array());
     return $properties;
 }
开发者ID:carnevlu,项目名称:repoman,代码行数:16,代码来源:store.class.php

示例2: loadManagerFiles

    /**
     * @param modManagerController $controller
     * @param modResource $resource
     */
    public function loadManagerFiles(modManagerController $controller, modResource $resource)
    {
        $modx23 = (int) $this->systemVersion();
        $cssUrl = $this->config['cssUrl'] . 'mgr/';
        $jsUrl = $this->config['jsUrl'] . 'mgr/';
        $properties = $resource->getProperties('modupdater');
        $controller->addLexiconTopic('modupdater:default');
        $controller->addJavascript($jsUrl . 'modupdater.js');
        $controller->addLastJavascript($jsUrl . 'misc/utils.js');
        $controller->addCss($cssUrl . 'main.css');
        if (!$modx23) {
            $controller->addCss($cssUrl . 'font-awesome.min.css');
        }
        $controller->addHtml('
		<script type="text/javascript">
			MODx.modx23 = ' . $modx23 . ';
			modUpdater.config = ' . $this->modx->toJSON($this->config) . ';
			modUpdater.config.resID = ' . $resource->id . ';
            modUpdater.config.connector_url = "' . $this->config['connectorUrl'] . '";
		</script>', true);
        $controller->addLastJavascript($jsUrl . 'widgets/items.windows.js');
    }
开发者ID:Homchenkokostya,项目名称:simpleUpdater,代码行数:26,代码来源:modupdater.class.php

示例3: loadManagerFiles

    /**
     * @param modManagerController $controller
     * @param modResource $resource
     */
    public function loadManagerFiles(modManagerController $controller, modResource $resource)
    {
        $modx23 = (int) $this->systemVersion();
        $cssUrl = $this->config['cssUrl'] . 'mgr/';
        $jsUrl = $this->config['jsUrl'] . 'mgr/';
        $properties = $resource->getProperties('ms2gallery');
        if (empty($properties['media_source'])) {
            if (!($source_id = $resource->getTVValue('ms2Gallery'))) {
                /** @var modContextSetting $setting */
                $setting = $this->modx->getObject('modContextSetting', array('key' => 'ms2gallery_source_default', 'context_key' => $resource->get('context_key')));
                $source_id = !empty($setting) ? $setting->get('value') : $this->modx->getOption('ms2gallery_source_default');
            }
            $resource->setProperties(array('media_source' => $source_id), 'ms2gallery');
            $resource->save();
        } else {
            $source_id = $properties['media_source'];
        }
        if (empty($source_id)) {
            $source_id = $this->modx->getOption('ms2gallery_source_default');
        }
        $resource->set('media_source', $source_id);
        $controller->addLexiconTopic('ms2gallery:default');
        $controller->addJavascript($jsUrl . 'ms2gallery.js');
        $controller->addLastJavascript($jsUrl . 'misc/ms2.combo.js');
        $controller->addLastJavascript($jsUrl . 'misc/ms2.utils.js');
        $controller->addLastJavascript($jsUrl . 'misc/plupload/plupload.full.js');
        $controller->addLastJavascript($jsUrl . 'misc/ext.ddview.js');
        $controller->addLastJavascript($jsUrl . 'gallery.view.js');
        $controller->addLastJavascript($jsUrl . 'gallery.window.js');
        $controller->addLastJavascript($jsUrl . 'gallery.toolbar.js');
        $controller->addLastJavascript($jsUrl . 'gallery.panel.js');
        $controller->addCss($cssUrl . 'main.css');
        if (!$modx23) {
            $controller->addCss($cssUrl . 'font-awesome.min.css');
        }
        $source_config = array();
        /** @var modMediaSource $source */
        if ($source = $this->modx->getObject('modMediaSource', $source_id)) {
            $tmp = $source->getProperties();
            foreach ($tmp as $v) {
                $source_config[$v['name']] = $v['value'];
            }
        }
        $controller->addHtml('
		<script type="text/javascript">
			MODx.modx23 = ' . $modx23 . ';
			ms2Gallery.config = ' . $this->modx->toJSON($this->config) . ';
			ms2Gallery.config.media_source = ' . $this->modx->toJSON($source_config) . ';
		</script>');
        if ($this->modx->getOption('ms2gallery_new_tab_mode', null, true)) {
            $controller->addLastJavascript($jsUrl . 'tab.js');
        } else {
            $insert = '
				tabs.add({
					xtype: "ms2gallery-page",
					id: "ms2gallery-page",
					title: _("ms2gallery"),
					record: {
						id: ' . $resource->get('id') . ',
						source: ' . $source_id . ',
					}
				});
			';
            if ($this->modx->getCount('modPlugin', array('name' => 'AjaxManager', 'disabled' => false))) {
                $controller->addHtml('
				<script type="text/javascript">
					Ext.onReady(function() {
						window.setTimeout(function() {
							var tabs = Ext.getCmp("modx-resource-tabs");
							if (tabs) {
								' . $insert . '
							}
						}, 10);
					});
				</script>');
            } else {
                $controller->addHtml('
				<script type="text/javascript">
					Ext.ComponentMgr.onAvailable("modx-resource-tabs", function() {
						var tabs = this;
						tabs.on("beforerender", function() {
							' . $insert . '
						});
					});
				</script>');
            }
        }
    }
开发者ID:arkadiy-vl,项目名称:ms2Gallery,代码行数:92,代码来源:ms2gallery.class.php

示例4: getProperties

 /**
  * Get the properties for the specific namespace for the Resource
  *
  * @param string $namespace
  *
  * @return array
  */
 public function getProperties($namespace = 'tickets')
 {
     $properties = parent::getProperties($namespace);
     // Convert old settings
     if (empty($this->reloadOnly)) {
         $flag = false;
         $tmp = array('disable_jevix', 'process_tags', 'rating');
         if ($old = parent::get('properties')) {
             foreach ($tmp as $v) {
                 if (array_key_exists($v, $old)) {
                     $properties[$v] = $old[$v];
                     $flag = true;
                     unset($old[$v]);
                 }
             }
             if ($flag) {
                 $old['tickets'] = $properties;
                 $this->set('properties', $old);
                 $this->save();
             }
         }
     }
     // --
     if (empty($properties)) {
         /** @var TicketsSection $parent */
         if (!($parent = $this->getOne('Parent'))) {
             $parent = $this->xpdo->newObject('TicketsSection');
         }
         $default_properties = $parent->getProperties($namespace);
         if (!empty($default_properties)) {
             foreach ($default_properties as $key => $value) {
                 if (!isset($properties[$key])) {
                     $properties[$key] = $value;
                 } elseif ($properties[$key] === 'true') {
                     $properties[$key] = true;
                 } elseif ($properties[$key] === 'false') {
                     $properties[$key] = false;
                 } elseif (is_numeric($value) && $key == 'disable_jevix' || $key == 'process_tags') {
                     $properties[$key] = boolval(intval($value));
                 }
             }
         }
     }
     return $properties;
 }
开发者ID:soulcreate,项目名称:Tickets,代码行数:52,代码来源:ticket.class.php

示例5: getProperties

 /**
  * Get the properties for the specific namespace for the Resource
  *
  * @param string $namespace
  *
  * @return array
  */
 public function getProperties($namespace = 'tickets')
 {
     $properties = parent::getProperties($namespace);
     if ($namespace == 'tickets') {
         $default_properties = array('template' => $this->xpdo->context->getOption('tickets.default_template', 0), 'uri' => '%id-%alias%ext', 'show_in_tree' => $this->xpdo->context->getOption('tickets.ticket_show_in_tree_default', false), 'hidemenu' => $this->xpdo->context->getOption('tickets.ticket_hidemenu_force', $this->xpdo->context->getOption('hidemenu_default')), 'disable_jevix' => $this->xpdo->context->getOption('tickets.disable_jevix_default', false), 'process_tags' => $this->xpdo->context->getOption('tickets.process_tags_default', false));
         // Old default values
         if (array_key_exists('tickets.ticket_id_as_alias', $this->xpdo->config)) {
             $default_properties['uri'] = $this->xpdo->context->getOption('tickets.ticket_id_as_alias') ? '%id' : '%alias';
             $default_properties['uri'] .= $this->xpdo->context->getOption('tickets.ticket_isfolder_force') ? '/' : '%ext';
         }
         foreach ($default_properties as $key => $value) {
             if (!isset($properties[$key])) {
                 $properties[$key] = $value;
             } elseif ($properties[$key] === 'true') {
                 $properties[$key] = true;
             } elseif ($properties[$key] === 'false') {
                 $properties[$key] = false;
             } elseif (is_numeric($value) && ($key == 'disable_jevix' || $key == 'process_tags')) {
                 $properties[$key] = (bool) intval($value);
             }
         }
     } elseif ($namespace == 'ratings') {
         $default_properties = array('ticket' => $this->xpdo->context->getOption('tickets.rating_ticket_default', 10), 'comment' => $this->xpdo->context->getOption('tickets.rating_comment_default', 1), 'view' => $this->xpdo->context->getOption('tickets.rating_view_default', 0.1), 'vote_ticket' => $this->xpdo->context->getOption('tickets.rating_vote_ticket_default', 1), 'vote_comment' => $this->xpdo->context->getOption('tickets.rating_vote_comment_default', 0.2), 'star_ticket' => $this->xpdo->context->getOption('tickets.rating_star_ticket_default', 3), 'star_comment' => $this->xpdo->context->getOption('tickets.rating_star_comment_default', 0.6));
         foreach ($default_properties as $key => $value) {
             if (!isset($properties[$key])) {
                 $properties[$key] = $value;
             }
         }
     }
     return $properties;
 }
开发者ID:soulcreate,项目名称:Tickets,代码行数:38,代码来源:ticketssection.class.php


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