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


PHP JavaScriptHelper::addObject方法代码示例

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


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

示例1: display

 /**
  * Displays the view.
  *
  * @param  string $tpl the template name
  *
  * @return void
  * @since  1.0
  */
 public function display($tpl = null)
 {
     $isNew = !JRequest::getInt('list_id', false);
     if ($isNew && !AclHelper::actionIsAllowed('list.add') || !$isNew && !AclHelper::actionIsAllowed('list.edit')) {
         $msg = $isNew ? 'JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED' : 'JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED';
         JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_newsletter&view=subscribers', false), JText::_($msg), 'error');
         return;
     }
     //TODO: Bulk-code. Need to refactor
     $listId = JRequest::getInt('list_id', 0);
     switch (JRequest::getString('subtask', '')) {
         case 'import':
             $this->subtask = 1;
             break;
         case 'exclude':
             $this->subtask = 2;
             break;
         default:
             $this->subtask = 0;
     }
     JavaScriptHelper::addStringVar('subtask', $this->subtask);
     $script = $this->get('Script');
     $this->script = $script;
     $this->listForm = $this->get('Form', 'list');
     $this->setModel(JModel::getInstance('subscribers', 'NewsletterModel'));
     $sess = JFactory::getSession();
     $data = $sess->get('list.' . $listId . '.file.uploaded');
     if ($data) {
         JavaScriptHelper::addObject('uploadData', $data);
     }
     $modelSubs = new NewsletterModelSubscribers();
     $modelSubs->setState('list.limit', 10);
     if (!empty($listId)) {
         $this->subs = $modelSubs->getSubscribersByList(array('list_id' => JRequest::getInt('list_id')));
         $items = $modelSubs->getUnsubscribedList(array('list_id' => JRequest::getInt('list_id')));
     } else {
         $items = array();
         $this->subs = array();
     }
     $ss = (object) array('items' => $items, 'state' => $modelSubs->getState(), 'listOrder' => $modelSubs->getState('list.unsubscribed.ordering'), 'listDirn' => $modelSubs->getState('list.unsubscribed.direction'));
     $this->assignRef('subscribers', $ss);
     // get data for "excluded"
     $model = JModel::getInstance('lists', 'NewsletterModel');
     // get only active lists
     $model->setState('filter.fields', array('a.state="1"', 'a.list_id<>' . JRequest::getInt('list_id')));
     $this->lists = (object) array('items' => $model->getItems(), 'state' => $model->getState(), 'listOrder' => $model->getState('list.ordering'), 'listDirn' => $model->getState('list.direction'));
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // We don't need toolbar in the modal window.
     $this->addToolbar();
     $config = JComponentHelper::getParams('com_media');
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     $append = '';
     if ($config->get('enable_flash', 1)) {
         JHTML::stylesheet('media/com_newsletter/css/uploaders.css');
         JHTML::script(JURI::root() . "administrator/components/com_newsletter/views/list/uploaders.js");
         $fileTypes = $config->get('image_extensions', 'bmp,gif,jpg,png,jpeg');
         $types = explode(',', $fileTypes);
         $displayTypes = '';
         // this is what the user sees
         $filterTypes = '';
         // this is what controls the logic
         $firstType = true;
         foreach ($types as $type) {
             if (!$firstType) {
                 $displayTypes .= ', ';
                 $filterTypes .= '; ';
             } else {
                 $firstType = false;
             }
             $displayTypes .= '*.' . $type;
             $filterTypes .= '*.' . $type;
         }
         $typeString = '{ \'' . JText::_('COM_MEDIA_FILES', 'true') . ' (' . $displayTypes . ')\': \'' . $filterTypes . '\' }';
     }
     /*
      * Display form for FTP credentials?
      * Don't set them here, as there are other functions called before this one if there is any file write operation
      */
     jimport('joomla.client.helper');
     $ftp = !JClientHelper::hasCredentials('ftp');
     $this->assignRef('session', JFactory::getSession());
     $this->assignRef('config', $config);
     $this->assignRef('state', $this->get('state'));
     $this->assignRef('folderList', $this->get('folderList'));
     $this->assign('require_ftp', $ftp);
     $this->setStatisticsData();
     // Set the document
//.........这里部分代码省略.........
开发者ID:Rikisha,项目名称:proj,代码行数:101,代码来源:view.html.php


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