• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP sfSympalConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _parseSyntaxes

 /**
  * Searches through the content and extracts out any matches. The return
  * value is a formatted array of what needs to be replaced
  * 
  * Returned syntax will look like this:
  *   array(
  *     'link' => array(
  *       3 => array('options' => array(), 'replace' => '[link:3]'),
  *       5 => array('options' => array('option' => 'value'), 'replace' => '[link:5 option=value]'),
  *     ), asset => array(
  *       10 => array('options' => array(), 'replace' => '[asset:10]'),
  *     ),
  *   )
  * 
  * @return array
  */
 private function _parseSyntaxes($content)
 {
     // create the replacement string (e.g. link|asset|myObject)
     $replacementString = implode('|', array_keys(sfSympalConfig::get('content_syntax_types')));
     preg_match_all("/\\[({$replacementString}):(.*?)\\]/", $content, $matches);
     if (isset($matches[0]) && $matches[0]) {
         $replacements = array();
         $types = $matches[1];
         $bodies = $matches[2];
         foreach ($types as $type) {
             $replacements[$type] = array();
         }
         /*
          * body matches (e.g. "3" or "5 option=value")
          */
         foreach ($bodies as $key => $body) {
             // use the key to find the corresponding type
             $typeKey = $types[$key];
             $e = explode(' ', $body);
             $slug = $e[0];
             $replacements[$typeKey][$slug] = array('options' => _parse_attributes(substr($body, strlen($e[0]))), 'replace' => $matches[0][$key]);
         }
         return $replacements;
     } else {
         return false;
     }
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:43,代码来源:sfSympalContentReplacer.class.php


示例2: _getForm

 /**
  * Returns the config form and checks the file permissions
  * 
  * @return sfSympalConfigForm
  */
 protected function _getForm()
 {
     $this->checkFilePermissions();
     $class = sfSympalConfig::get('config_form_class', null, 'sfSympalConfigForm');
     $this->form = new $class();
     return $this->form;
 }
开发者ID:sympal,项目名称:sympal,代码行数:12,代码来源:Basesympal_configActions.class.php


示例3: enableSympalResultCache

 /**
  * Enable Sympal result cache for this query if it is enabled via configuration
  *
  * @param string $key 
  * @return Doctrine_Query $query
  */
 public function enableSympalResultCache($key)
 {
     if ($lifetime = sfSympalConfig::shouldUseResultCache($key)) {
         $this->useResultCache(true, $lifetime, $key);
     }
     return $this;
 }
开发者ID:sympal,项目名称:sympal,代码行数:13,代码来源:sfSympalDoctrineQuery.class.php


示例4: uninstall

 public function uninstall($delete = null)
 {
     if ($delete !== null) {
         $this->setOption('delete_plugin_files', $delete);
     }
     $this->logSection('sympal', sprintf('Uninstalling Sympal plugin named "%s"', $this->_pluginName));
     if ($this->hasModels()) {
         if ($this->getOption('build_all_classes')) {
             $this->_buildAllClasses();
         }
         if ($this->getOption('delete_related_data')) {
             $this->_deleteRelatedData();
         }
         if ($this->getOption('delete_other_data')) {
             $this->_deleteOtherData();
         }
         if ($this->getOption('drop_database_tables')) {
             $this->_dropDatabaseTables();
         }
     }
     if ($this->getOption('run_custom_install')) {
         $this->_runCustomUninstall();
     }
     if ($this->getOption('delete_plugin_files')) {
         $this->_deletePluginFiles();
     }
     if ($this->getOption('publish_assets')) {
         $this->_publishAssets();
     }
     $this->_clearCache();
     sfSympalConfig::writeSetting($this->_pluginName, 'installed', false);
 }
开发者ID:sympal,项目名称:sympal,代码行数:32,代码来源:sfSympalPluginManagerUninstall.class.php


示例5: __construct

 /**
  * Instantiate the sfSympalCache instance and prime the cache for this Sympal
  * project
  *
  * @see sfSympalConfiguration
  * @see sfSympalPluginConfiguration
  * @param sfSympalConfiguration $sympalConfiguration
  */
 public function __construct(sfSympalConfiguration $sympalConfiguration)
 {
     $this->_sympalConfiguration = $sympalConfiguration;
     $this->_projectConfiguration = $sympalConfiguration->getProjectConfiguration();
     $this->_cacheDriver = call_user_func_array(sfSympalConfig::get('get_cache_driver_callback'), array($this));
     $this->primeCache();
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:15,代码来源:sfSympalCache.class.php


示例6: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     foreach ($arguments['configure'] as $value) {
         list($key, $value) = explode('=', $value);
         $e = explode('.', $key);
         $group = isset($e[1]) ? $e[0] : null;
         $key = isset($e[1]) ? $e[1] : $e[0];
         $value = is_numeric($value) ? (int) $value : $value;
         $value = $value == 'false' ? false : $value;
         $value = $value == 'true' ? true : $value;
         $infoValue = $value;
         if (in_array(substr($value, 0, 1), array('[', '{'))) {
             $value = sfYamlInline::load($value);
             $infoValue = 'YAML: ' . $infoValue;
         }
         $writeToApp = isset($options['application']) && $options['application'] ? true : false;
         if ($group) {
             $this->logSection('sympal', sprintf('Writing setting "%s" with a value of "%s" under the "%s" group.', $key, $infoValue, $group));
             sfSympalConfig::writeSetting($group, $key, $value, $writeToApp);
         } else {
             $this->logSection('sympal', sprintf('Writing setting "%s" with a value of "%s".', $key, $infoValue, $group));
             sfSympalConfig::writeSetting($key, $value, null, $writeToApp);
         }
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:28,代码来源:sfSympalConfigureTask.class.php


示例7: executeSlot_save

 /**
  * Handles the form submit for a given slot. This could come from two sources:
  *   1) Inline, frontend editing. (ajax request)
  *   2) Admin, non-inline editing (non-ajax request)
  */
 public function executeSlot_save(sfWebRequest $request)
 {
     $this->contentSlot = $this->setupContentSlot($request);
     $this->form = $this->contentSlot->getEditForm();
     $this->form->bind($request->getParameter($this->form->getName()));
     if ($this->form->isValid()) {
         $this->form->save();
         $this->getUser()->setFlash('saved', __('Slot saved'), false);
         // if we close editor on save, just return the flash js and the editor close js
         if ($request->isXmlHttpRequest() && sfSympalConfig::get('inline_editing', 'close_editor_on_save', false)) {
             $this->getContext()->getConfiguration()->loadHelpers('SympalContentSlotEditor');
             $this->renderText(trigger_flash_from_user($this->getUser()));
             $this->renderText(sprintf('
     <script type="text/javascript">
       $(document).ready(function() {
         $("#sympal_slot_wrapper_%s").sympalSlot("closeEditor");
       });
     </script>
     ', $this->contentSlot->id));
             return sfView::NONE;
         }
     } else {
         $this->getUser()->setFlash('error', __('There was an error saving your slot'), false);
     }
     // we need to route the response appropriately based on ajax/non-ajax
     if ($request->isXmlHttpRequest()) {
         // ajax, just re-show the form
         $this->renderPartial('sympal_edit_slot/slot_editor_form');
     } else {
         // handle non-ajax, which come from sympal_content/edit_slots
         // this is a bit of a hack, we redirect even on errors, which is technically a fail
         $this->redirect('@sympal_content_edit_slots?id=' . $this->contentSlot->getContentRenderedFor()->id);
     }
     return sfView::NONE;
 }
开发者ID:sympal,项目名称:sympal,代码行数:40,代码来源:Basesympal_edit_slotActions.class.php


示例8: loadEditorAssets

 public function loadEditorAssets()
 {
     if (!$this->_editorAssetsLoaded) {
         $this->configuration->loadHelpers('SympalContentSlotEditor');
         sfSympalToolkit::useJQuery(array('ui'));
         $response = sfContext::getInstance()->getResponse();
         // Load jquery tools/plugins that the inline editor requires
         $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jQuery.cookie.js'));
         $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jQuery.elastic.js'));
         $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jquery.Jcrop.min.js'));
         // Load markitup markdown editor
         if (sfSympalConfig::get('enable_markdown_editor')) {
             $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/jquery.markitup.js'));
             $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/sets/markdown/set.js'));
             $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/skins/markitup/style.css'));
             $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/sets/markdown/style.css'));
         }
         // Load tinymce
         $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/tiny_mce/tiny_mce.js'));
         // Load the sympal editor js and css
         $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/editor.js'));
         $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/css/editor.css'));
         // Fancybox
         $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/fancybox/jquery.fancybox.js'));
         $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalPlugin/fancybox/jquery.fancybox.css'));
         // Shortcuts
         $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/shortcuts.js'));
         $this->_editorAssetsLoaded = true;
     }
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:30,代码来源:sfSympalEditorPluginConfiguration.class.php


示例9: _checkInstalled

 /**
  * Check if Sympal is installed and redirect to installer if not.
  * Do some other install checks as well.
  *
  * @return void
  */
 private function _checkInstalled()
 {
     $request = $this->_symfonyContext->getRequest();
     // Prepare the symfony application if it has not been prepared yet
     if (!$this->_symfonyContext->getUser() instanceof sfSympalUser) {
         chdir(sfConfig::get('sf_root_dir'));
         $task = new sfSympalEnableForAppTask($this->_dispatcher, new sfFormatter());
         $task->run(array($this->_invoker->getProjectConfiguration()->getApplication()), array());
         $this->_symfonyContext->getController()->redirect('@homepage');
     }
     /*
      * Redirect to install module if...
      *   * not in test environment
      *   * sympal has not been installed
      *   * module is not already sympal_install
      */
     if (sfConfig::get('sf_environment') != 'test' && !sfSympalConfig::get('installed') && $request->getParameter('module') != 'sympal_install') {
         $this->_symfonyContext->getController()->redirect('@sympal_install');
     }
     /*
      * Redirect to homepage if no site record exists so we can prompt the
      * user to create a site record for this application.
      * 
      * This check is only ran in dev mode
      */
     if (sfConfig::get('sf_environment') == 'dev' && !$this->_sympalContext->getSite() && $this->_symfonyContext->getRequest()->getPathInfo() != '/') {
         $this->_symfonyContext->getController()->redirect('@homepage');
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:35,代码来源:sfSympalContextLoadFactoriesListener.class.php


示例10: install

 public function install()
 {
     if ($this->getOption('uninstall_first')) {
         $uninstall = new sfSympalPluginManagerUninstall($this->_pluginName, $this->_configuration, $this->_formatter);
         $uninstall->setOption('publish_assets', false);
         $uninstall->uninstall();
     }
     $this->logSection('sympal', sprintf('Installing Sympal plugin named "%s"', $this->_pluginName));
     try {
         if ($this->getOption('create_tables')) {
             $this->_createDatabaseTables();
         }
         if ($this->getOption('load_data')) {
             $this->_loadData();
         }
         if ($this->getOption('publish_assets')) {
             $this->_publishAssets();
         }
         if ($this->getOption('clear_cache')) {
             $this->_clearCache();
         }
         sfSympalConfig::writeSetting($this->_pluginName, 'installed', true);
     } catch (Exception $e) {
         $uninstall = new sfSympalPluginManagerUninstall($this->_pluginName, $this->_configuration);
         $uninstall->uninstall();
         throw $e;
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:28,代码来源:sfSympalPluginManagerInstall.class.php


示例11: getEmbed

    public function getEmbed($options = array())
    {
        $url = $this->getUrl();
        $width = isset($options['width']) ? $options['width'] : sfSympalConfig::get('default_video_width', null, 400);
        $height = isset($options['height']) ? $options['height'] : sfSympalConfig::get('default_video_height', null, 400);
        $extension = $this->getExtension();
        $id = $this->getDoctrineAsset()->getId();
        if ($extension == 'swf') {
            return sprintf('<object width="%s" height="%s">
<param name="movie" value="%s">
<embed src="%s" width="%s" height="%s">
</embed>
</object>', $width, $height, $url, $url, $width, $height);
        } else {
            if ($extension == 'flv') {
                sympal_use_jquery();
                sympal_use_javascript('/sfSympalPlugin/js/flowplayer.min.js');
                return sprintf('<a href="%s" style="display:block;width:%spx;height:%spx;" id="asset_%s"></a>
<script language="JavaScript"> 
    flowplayer("asset_%s", "%s"); 
</script>', $url, $width, $height, $id, $id, _compute_public_path('/sfSympalPlugin/js/flowplayer.swf', 'swf', 'swf'));
            } else {
                return $this->getLink($options);
            }
        }
    }
开发者ID:sympal,项目名称:sympal,代码行数:26,代码来源:sfSympalAssetVideoObject.class.php


示例12: get_sympal_content_slot_editor

/**
 * Renders an edit form for a slot
 * 
 * @param sfSympalContent $content The content on which the slot should be rendered
 * @param sfSympalContentSlot $slot The slot to render in a form
 * @param array $options An options array. Available options include:
 *   * edit_mode
 * 
 */
function get_sympal_content_slot_editor($content, $slot, $options = array())
{
    $slot->setContentRenderedFor($content);
    // merge in some global default slot options
    $options = array_merge(array('edit_mode' => sfSympalConfig::get('inline_editing', 'default_edit_mode'), 'view_url' => url_for('sympal_content_slot_view', array('id' => $slot->id, 'content_id' => $slot->getContentRenderedFor()->id))), $options);
    // merge the default config for this slot into the given config
    $slotOptions = sfSympalConfig::get($slot->getContentRenderedFor()->Type->slug, 'content_slots', array());
    if (isset($slotOptions[$slot->name])) {
        $options = array_merge($slotOptions[$slot->name], $options);
    }
    /*
     * Finally, override the "type" option, it should be set to whatever's
     * in the database, regardless of what the original slot options were
     */
    $options['type'] = $slot->type;
    /*
     * Give the slot a default value if it's blank.
     * 
     * @todo Move this somewhere where it can be specified on a type-by-type
     * basis (e.g., if we had an "image" content slot, it might say
     * "Click to choose image"
     */
    $renderedValue = $slot->render();
    if (!$renderedValue) {
        $renderedValue = __('[Hover over and click edit to change.]');
    }
    $inlineContent = sprintf('<a href="%s" class="sympal_slot_button">' . __('Edit') . '</a>', url_for('sympal_content_slot_form', array('id' => $slot->id, 'content_id' => $slot->getContentRenderedFor()->id)));
    $inlineContent .= sprintf('<span class="sympal_slot_content">%s</span>', $renderedValue);
    return sprintf('<span class="sympal_slot_wrapper %s" id="sympal_slot_wrapper_%s">%s</span>', htmlentities(json_encode($options)), $slot->id, $inlineContent);
}
开发者ID:RafalJachimczyk,项目名称:sympal,代码行数:39,代码来源:SympalContentSlotEditorHelper.php


示例13: setup

 public function setup()
 {
     parent::setup();
     $q = Doctrine_Query::create()->from('sfSympalMenuItem m');
     if ($this->object->exists()) {
         $q->andWhere('m.id != ?', $this->object->id);
     }
     if (sfSympalConfig::isI18nEnabled('sfSympalMenuItem')) {
         $q->leftJoin('m.Translation mt');
     }
     $q->andWhere('m.site_id = ?', sfSympalContext::getInstance()->getService('site_manager')->getSite()->getId());
     $this->widgetSchema['parent_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'sfSympalMenuItem', 'add_empty' => __('~ (object is at root level)'), 'order_by' => array('root_id, lft', ''), 'query' => $q, 'method' => 'getIndentedName'));
     $this->validatorSchema['parent_id'] = new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'sfSympalMenuItem'));
     $this->setDefault('parent_id', $this->object->getParentId());
     $this->widgetSchema->setLabel('parent_id', 'Child of');
     $this->widgetSchema['move'] = new sfWidgetFormDoctrineChoice(array('model' => 'sfSympalMenuItem', 'add_empty' => true, 'order_by' => array('root_id, lft', ''), 'query' => $q, 'method' => 'getIndentedName'));
     $this->validatorSchema['move'] = new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'sfSympalMenuItem'));
     $this->widgetSchema->setLabel('move', 'Position menu item');
     $choices = array('' => '', 'Prev' => 'Before', 'Next' => 'After');
     $this->widgetSchema['where_to_move'] = new sfWidgetFormChoice(array('choices' => $choices));
     $this->validatorSchema['where_to_move'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($choices)));
     $this->widgetSchema->setLabel('where_to_move', 'Position before or after?');
     unset($this['site_id'], $this['Content'], $this['root_id'], $this['lft'], $this['rgt'], $this['level']);
     $this->validatorSchema['slug']->setOption('required', true);
 }
开发者ID:sympal,项目名称:sympal,代码行数:25,代码来源:PluginsfSympalMenuItemForm.class.php


示例14: run

    public function run(sfEvent $event, $content)
    {
        // The following were removed, but should probably be there
        //$request->isXmlHttpRequest()
        //$controller->getRenderMode() != sfView::RENDER_CLIENT ||
        $response = $event->getSubject();
        if (strpos($response->getContentType(), 'html') === false || $response->getStatusCode() == 304 || in_array($response->getStatusCode(), array(302, 301)) || $response->isHeaderOnly()) {
            return $content;
        }
        if ($code = sfSympalConfig::get('google_analytics_code')) {
            $js = <<<EOF
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
\tdocument.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
\tvar pageTracker = _gat._getTracker("{$code}");
\tpageTracker._trackPageview();
} catch(err) {}</script>
EOF;
            return str_replace('</body>', $js . '</body>', $content);
        } else {
            return $content;
        }
    }
开发者ID:sympal,项目名称:sympal,代码行数:26,代码来源:sfSympalRenderingResponseFilterContentListener.class.php


示例15: executeCreate_asset

 public function executeCreate_asset(sfWebRequest $request)
 {
     $form = new sfSympalAssetUploadForm();
     $upload = $request->getParameter($form->getName());
     $form->setUploadDirectory($upload['directory']);
     $form->bind($upload, $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $postFile = $form->getValue('file');
         $fileName = $postFile->getOriginalName();
         $name = Doctrine_Inflector::urlize(sfSympalAssetToolkit::getNameFromFile($fileName));
         $extension = pathinfo($fileName, PATHINFO_EXTENSION);
         $fullName = $extension ? $name . '.' . $extension : $name;
         $destinationDirectory = sfConfig::get('sf_web_dir') . '/' . sfSympalConfig::get('assets', 'root_dir') . $upload['directory'];
         $this->getUser()->setFlash('notice', 'File uploaded successfully.');
         $postFile->save($destinationDirectory . '/' . $fullName);
         $assetObject = sfSympalAssetToolkit::createAssetObject($upload['directory'] . '/' . $fullName);
         if (!($asset = $assetObject->getDoctrineAsset())) {
             $asset = new sfSympalAsset();
         }
         $asset->path = $assetObject->getRelativePathDirectory();
         $asset->name = $assetObject->getName();
         $asset->save();
     } else {
         $this->getUser()->setFlash('error', 'Could not upload file.');
     }
     if ($this->isAjax) {
         $this->redirect('@sympal_assets_select?is_ajax=' . $this->isAjax . '&dir=' . $upload['directory']);
     } else {
         $this->redirect('@sympal_assets?is_ajax=' . $this->isAjax . '&dir=' . $upload['directory']);
     }
 }
开发者ID:RafalJachimczyk,项目名称:sympal,代码行数:31,代码来源:Basesympal_assetsActions.class.php


示例16: executeLanguage

 public function executeLanguage(sfWebRequest $request)
 {
     $this->form = new sfFormLanguage($this->getUser(), array('languages' => sfSympalConfig::getLanguageCodes()));
     unset($this->form[$this->form->getCSRFFieldName()]);
     $widgetSchema = $this->form->getWidgetSchema();
     $widgetSchema->setLabel('language', 'Select Language');
 }
开发者ID:sympal,项目名称:sympal,代码行数:7,代码来源:Basesympal_defaultComponents.class.php


示例17: executeIndex

 public function executeIndex()
 {
     $response = $this->getResponse();
     $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/shortcuts.js'));
     $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalAdminPlugin/js/shortcuts.js'));
     if (sfSympalConfig::get('check_for_upgrades_on_dashboard', null, false)) {
         $this->upgrade = new sfSympalUpgradeFromWeb($this->getContext()->getConfiguration(), $this->getContext()->getEventDispatcher(), new sfFormatter());
         $this->hasNewVersion = $this->upgrade->hasNewVersion();
     } else {
         $this->hasNewVersion = false;
     }
     $this->dashboardRight = new sfSympalMenu('Sympal Dashboard Right');
     $numUsers = Doctrine_Core::getTable('sfGuardUser')->count();
     $this->dashboardRight->addChild(sprintf('<label>Users</label> %s', $numUsers), '@sympal_users');
     $numSites = Doctrine_Core::getTable('sfSympalSite')->count();
     $this->dashboardRight->addChild(sprintf('<label>Sites</label> %s', $numSites), '@sympal_sites');
     $numContentTypes = Doctrine_Core::getTable('sfSympalContentType')->count();
     $this->dashboardRight->addChild(sprintf('<label>Content Types</label> %s', $numContentTypes), '@sympal_content_types');
     $contentTypes = Doctrine::getTable('sfSympalContentType')->getAllContentTypes();
     foreach ($contentTypes as $contentType) {
         $numPublishedContent = Doctrine_Core::getTable('sfSympalContent')->createQuery('c')->where('c.date_published < NOW()')->andWhere('c.content_type_id = ?', $contentType->getId())->count();
         $this->dashboardRight->addChild(sprintf('<label>Published %s Content</label> %s', $contentType->getLabel(), $numPublishedContent), '@sympal_content_list_type?type=' . $contentType->getId() . '&published=1');
         $numUnPublishedContent = Doctrine_Core::getTable('sfSympalContent')->createQuery('c')->where('c.date_published >= NOW() OR c.date_published IS NULL')->andWhere('c.content_type_id = ?', $contentType->getId())->count();
         $this->dashboardRight->addChild(sprintf('<label>Un-Published %s Content</label> %s', $contentType->getLabel(), $numUnPublishedContent), '@sympal_content_list_type?type=' . $contentType->getId() . '&published=0');
     }
     sfApplicationConfiguration::getActive()->getEventDispatcher()->notify(new sfEvent($this->dashboardRight, 'sympal.load_dashboard_right'));
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:27,代码来源:Basesympal_dashboardActions.class.php


示例18: _get_sympal_content_slot

/**
 * Include a content slot in your template.
 * 
 * This replaces get_sympal_content_slot() and is intended to be easier
 * to use. This also taps into the app.yml config for its options
 * 
 * @param string $name The name of the slot
 * @param array  $options An array of options for this slot
 * 
 * Available options include
 *  * content         An sfSympalContent instance to render the slot for
 *  * type            The rendering type to use for this slot (e.g. Markdown)
 *  * default_value   A default value to give this slot the first time it's created
 *  * edit_mode       How to edit this slot (popup (default), inline)
 */
function _get_sympal_content_slot($name, $options = array())
{
    if (isset($options['content'])) {
        $content = $options['content'];
        unset($options['content']);
    } else {
        $content = sfSympalContext::getInstance()->getCurrentContent();
    }
    // mark this content record as having content slots
    $content->setEditableSlotsExistOnPage(true);
    // merge the default config for this slot into the given config
    $slotOptions = sfSympalConfig::get($content->Type->slug, 'content_slots', array());
    if (isset($slotOptions[$name])) {
        $options = array_merge($slotOptions[$name], $options);
    }
    // retrieve the slot
    if ($name instanceof sfSympalContentSlot) {
        $slot = $name;
        $name = $name->getName();
    } else {
        $slot = $content->getOrCreateSlot($name, $options);
        unset($options['default_value']);
    }
    $slot->setContentRenderedFor($content);
    /**
     * Either render the raw value or the editor for the slot
     */
    if (sfSympalContext::getInstance()->shouldLoadFrontendEditor()) {
        use_helper('SympalContentSlotEditor');
        return get_sympal_content_slot_editor($content, $slot, $options);
    } else {
        return $slot->render();
    }
}
开发者ID:RafalJachimczyk,项目名称:sympal,代码行数:49,代码来源:SympalContentSlotHelper.php


示例19: link_to_sympal_comment_website

/**
 * Returns the anchor tag to a comment's website
 * 
 * @param   string $url     The url of the website to link to
 * @param   string $label   The text to include inside the link
 * @param   array  $options An array of link options
 * @return  string
 */
function link_to_sympal_comment_website($comment, $options = array())
{
    if (sfSympalConfig::get('sfSympalCommentsPlugin', 'websites_no_follow')) {
        $options['rel'] = 'nofollow';
    }
    return link_to($comment['author_name'], $comment['website'], $options);
}
开发者ID:slemoigne,项目名称:sympal,代码行数:15,代码来源:CommentsHelper.php


示例20: buildDataGrid

 public function buildDataGrid(sfWebRequest $request)
 {
     if ($this->table_method) {
         $typeTable = Doctrine_Core::getTable($this->ContentType->name);
         $method = $this->table_method;
         $q = $typeTable->{$method}($this, $request);
         if ($q instanceof sfSympalDataGrid) {
             $dataGrid = $q;
         } else {
             if ($q instanceof sfDoctrinePager || $q instanceof Doctrine_Query_Abstract) {
                 $dataGrid = sfSympalDataGrid::create($q);
             } else {
                 throw new sfException(sprintf('ContentList table_method must return an instance of sfSympalDataGrid, sfDoctrinePager or Doctrine_Query_Abstract. An instance of "%s" was returned.', get_class($q)));
             }
         }
     } else {
         $pager = new sfDoctrinePager('sfSympalContent');
         $pager->setQuery($this->_buildQuery($request));
         $dataGrid = sfSympalDataGrid::create($pager)->addColumn('c.title', 'renderer=sympal_data_grid/default_title')->addColumn('c.date_published')->addColumn('u.username', 'label=Created By');
     }
     if ($this->sort_column) {
         $dataGrid->setDefaultSort($this->sort_column, $this->sort_order);
     }
     $dataGrid->setMaxPerPage($this->rows_per_page > 0 ? $this->rows_per_page : sfSympalConfig::get('rows_per_page', null, 10));
     $dataGridRequestInfo = $request->getParameter($dataGrid->getId());
     return $dataGrid;
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:27,代码来源:PluginsfSympalContentList.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sfTestBrowser类代码示例发布时间:2022-05-23
下一篇:
PHP sfStorage类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap