예제 #1
0
 function display()
 {
     require_once JPATH_COMPONENT . '/helpers/rokcandyhelper.php';
     // Load the submenu.
     RokCandyHelper::addSubmenu(JRequest::getCmd('view', 'macros'));
     switch ($this->getTask()) {
         case 'add':
             JRequest::setVar('hidemainmenu', 1);
             JRequest::setVar('layout', 'form');
             JRequest::setVar('view', 'candymacro');
             JRequest::setVar('edit', false);
             // Checkout the RokCandy Macro
             $model = $this->getModel('candymacro');
             $model->checkout();
             break;
         case 'edit':
             JRequest::setVar('hidemainmenu', 1);
             JRequest::setVar('layout', 'form');
             JRequest::setVar('view', 'candymacro');
             JRequest::setVar('edit', true);
             // Checkout the RokCandy Macro
             $model = $this->getModel('candymacro');
             $model->checkout();
             break;
         case 'list':
             JRequest::setVar('layout', 'list');
             JRequest::setVar('view', 'rokcandy');
     }
     parent::display();
 }
예제 #2
0
 function _initialize()
 {
     if ($this->_initialized) {
         JError::raiseWarning('1', 'RokCandy instanceId=' . $this->_instanceId . ' was initialized already');
         return true;
     }
     $document =& JFactory::getDocument();
     $doctype = $document->getType();
     $this->_library = RokCandyHelper::getMacros();
 }
 function _initialize()
 {
     if ($this->_initialized) {
         JError::raiseWarning('1', 'RokCandy instanceId=' . $this->_instanceId . ' was initialized already');
         return true;
     }
     $document =& JFactory::getDocument();
     $doctype = $document->getType();
     // Only render for HTML output
     if ($doctype !== 'html') {
         return false;
     }
     $this->_library = RokCandyHelper::getMacros();
 }
예제 #4
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', 1);
     $option = JFactory::getApplication()->input->get('option');
     $view = JFactory::getApplication()->input->get('view');
     $lang = JFactory::getLanguage();
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     $canDo = RokCandyHelper::getActions($this->state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('COM_ROKCANDY_MANAGER_MACRO'), 'rokcandy.png');
     // Build the actions for new and existing records.
     if ($isNew) {
         // For new records, check the create permission.
         if ($isNew && count($user->getAuthorisedCategories('com_rokcandy', 'core.create')) > 0) {
             JToolBarHelper::apply('candymacro.apply');
             JToolBarHelper::save('candymacro.save');
             JToolBarHelper::save2new('candymacro.save2new');
         }
         JToolBarHelper::cancel('candymacro.cancel');
     } else {
         // Can't save the record if it's checked out.
         if (!$checkedOut) {
             // Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
             if ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_by == $userId) {
                 JToolBarHelper::apply('candymacro.apply');
                 JToolBarHelper::save('candymacro.save');
                 // We can save this record, but check the create permission to see if we can return to make a new one.
                 if ($canDo->get('core.create')) {
                     JToolBarHelper::save2new('candymacro.save2new');
                 }
             }
         }
         // If checked out, we can still save
         if ($canDo->get('core.create')) {
             JToolBarHelper::save2copy('candymacro.save2copy');
         }
         JToolBarHelper::cancel('candymacro.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help(strtoupper($option) . '_' . strtoupper($view) . '_HELP_URL', TRUE, '', $option);
 }
예제 #5
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/rokcandy.php';
     $option = JFactory::getApplication()->input->get('option');
     $view = JFactory::getApplication()->input->get('view');
     $lang = JFactory::getLanguage();
     $canDo = RokCandyHelper::getActions($this->state->get('filter.category_id'));
     $user = JFactory::getUser();
     JToolBarHelper::title(JText::_('COM_ROKCANDY_MANAGER_MACRO'), 'rokcandy.png');
     if ($canDo->get('core.create') || count($user->getAuthorisedCategories('com_rokcandy', 'core.create')) > 0) {
         JToolBarHelper::addNew('candymacro.add');
     }
     if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) {
         JToolBarHelper::editList('candymacro.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish('candymacros.publish', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::unpublish('candymacros.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::divider();
         JToolBarHelper::archiveList('candymacros.archive');
         JToolBarHelper::checkin('candymacros.checkin');
     }
     if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'candymacros.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolBarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolBarHelper::trash('candymacros.trash');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_rokcandy');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help(strtoupper($option) . '_' . strtoupper($view) . '_HELP_URL', TRUE, '', $option);
     $version = new JVersion();
     if (version_compare($version->getShortVersion(), '3.0', '>=')) {
         JHtmlSidebar::setAction('index.php?option=com_rokcandy');
         JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true));
         JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_rokcandy'), 'value', 'text', $this->state->get('filter.category_id')));
     }
 }
예제 #6
0
 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_COMPONENT . '/helpers/rokcandy.php';
     $jinput = JFactory::getApplication()->input;
     // Load the submenu.
     RokCandyHelper::addSubmenu($jinput->get('view', 'candymacros'));
     $view = $jinput->get('view', 'candymacros');
     $layout = $jinput->get('layout', 'default');
     $id = $jinput->get('id', '', 'int');
     // Check for edit form.
     if ($view == 'candymacro' && $layout == 'edit' && !$this->checkEditId('com_rokcandy.edit.candymacro', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_rokcandy&view=candymacros', false));
         return false;
     }
     parent::display();
     return $this;
 }
 function readIniFile()
 {
     global $mainframe;
     $template = $mainframe->isAdmin() ? RokCandyHelper::getCurrentTemplate() : $mainframe->getTemplate();
     $path = JPATH_SITE . DS . "templates" . DS . $template . DS . "html" . DS . "com_rokcandy" . DS . "default.ini";
     $library = array();
     if (file_exists($path)) {
         jimport('joomla.filesystem.file');
         $content = JFile::read($path);
         $data = explode("\n", $content);
         foreach ($data as $line) {
             //skip comments
             if (strpos($line, "#") !== 0 and trim($line) != "") {
                 $div = strpos($line, "]=");
                 $library[substr($line, 0, $div + 1)] = substr($line, $div + 2);
             }
         }
     }
     return $library;
 }
예제 #8
0
파일: rokcandy.php 프로젝트: enjoy2000/smcd
 static function readIniFile()
 {
     $app = JFactory::getApplication();
     $template = $app->isAdmin() ? RokCandyHelper::getCurrentTemplate() : $app->getTemplate();
     $path = JPATH_SITE . "/templates/" . $template . "/html/com_rokcandy/default.ini";
     $library = array();
     if (file_exists($path)) {
         jimport('joomla.filesystem.file');
         $content = JFile::read($path);
         $data = explode("\n", $content);
         if (!empty($data)) {
             foreach ($data as $line) {
                 //skip comments
                 if (strpos($line, "#") !== 0 and trim($line) != "") {
                     $div = strpos($line, "]=");
                     $library[substr($line, 0, $div + 1)] = substr($line, $div + 2);
                 }
             }
         }
     }
     return $library;
 }
예제 #9
0
 function getTemplateOverrides()
 {
     return RokCandyHelper::getTemplateOverrides();
 }
예제 #10
0
                    <?php 
        echo $macro;
        ?>
                </div>
                <div class="pull-left"></div>
            </td>
            <td class="nowrap has-context"><?php 
        echo htmlentities($html);
        ?>
</td>
            <td align="nowrap has-context" class="macro"><?php 
        echo ucfirst(RokCandyHelper::getCurrentTemplate());
        ?>
 Overrides</td>
            <td align="center"><?php 
        echo strtolower(RokCandyHelper::getCurrentTemplate());
        ?>
        </tr>
            <?php 
    }
    ?>
        <?php 
}
?>
    </tbody>
    <tfoot>
    <tr>
        <td colspan="10">
            <?php 
echo $this->pagination->getListFooter();
?>
예제 #11
0
 function onAfterRoute()
 {
     $this->_library = RokCandyHelper::getMacros();
 }