示例#1
0
 public static function getDBO()
 {
     if (YireoHelper::isJoomla15()) {
         return JFactory::getDBO();
     }
     return JFactory::getDbo();
 }
示例#2
0
 /**
  * Method to load a specific plugin
  */
 public function getPlugin($type = null, $name = null)
 {
     // @todo: Does not work in J1.7
     $plugin = JPluginHelper::getPlugin($type, $name);
     if (empty($plugin) || !is_object($plugin)) {
         return null;
     }
     if (YireoHelper::isJoomla15()) {
         $path = JPATH_PLUGINS . '/' . $plugin->type . '/' . $plugin->name . '.php';
     } else {
         $path = JPATH_PLUGINS . '/' . $plugin->type . '/' . $plugin->name . '/' . $plugin->name . '.php';
     }
     if (!file_exists($path)) {
         return null;
     }
     // Include the plugin-file
     require_once $path;
     // Determine the class-name and return an instance
     $class = 'plg' . $plugin->type . $plugin->name;
     if (class_exists($class)) {
         $dispatcher =& JDispatcher::getInstance();
         $plugin = new $class($dispatcher, (array) $plugin);
         return $plugin;
     }
     return null;
 }
示例#3
0
 /**
  * Method to get the ordering query
  *
  * @access public 
  * @param null
  * @return string
  */
 public function getOrderingQuery()
 {
     if (YireoHelper::isJoomla15()) {
         $query = 'SELECT `ordering` AS `value`, `title` AS `text` FROM `#__categories` WHERE `section`="com_simplelists" ORDER BY ordering';
     } else {
         $query = 'SELECT `lft` AS `value`, `title` AS `text` FROM `#__categories` WHERE `extension`="com_simplelists" ORDER BY lft';
     }
     return $query;
 }
示例#4
0
 /**
  * Method to build the database query
  *
  * @access protected
  * @param null
  * @return mixed
  */
 protected function buildQuery()
 {
     if (YireoHelper::isJoomla15()) {
         $query = "SELECT `plugin`.*, {access}, {editor} FROM `#__plugins` AS `plugin`\n";
     } else {
         $query = "SELECT `plugin`.*, {access}, {editor} FROM `#__extensions` AS `plugin`\n";
     }
     return parent::buildQuery($query);
 }
示例#5
0
 public function getId($category_alias = null)
 {
     $db = YireoHelper::getDBO();
     if (YireoHelper::isJoomla15()) {
         $query = "SELECT `id` FROM `#__categories` WHERE `alias`=" . $db->quote($category_alias) . " AND `section`='com_simplelists' LIMIT 1";
     } else {
         $query = "SELECT `id` FROM `#__categories` WHERE `alias`=" . $db->quote($category_alias) . " AND `extension`='com_simplelists' LIMIT 1";
     }
     $db->setQuery($query);
     return $db->loadResult();
 }
示例#6
0
 /**
  * Load the parameters
  * 
  * @access private
  * @param null
  * @return JParameter
  */
 private function getParams()
 {
     if (YireoHelper::isJoomla15() == false) {
         return $this->params;
     } else {
         jimport('joomla.html.parameter');
         $plugin = JPluginHelper::getPlugin('content', 'simplelists');
         $params = new JParameter($plugin->params);
         return $params;
     }
 }
示例#7
0
 /**
  * Constructor
  *
  * @param object Database connector object
  */
 public function __construct(&$db)
 {
     // Initialize the default values
     if (YireoHelper::isJoomla15()) {
         $this->_defaults = array('section' => 'com_simplelists');
     } else {
         $this->_defaults = array('extension' => 'com_simplelists', 'level' => 1);
     }
     // Set the required fields
     $this->_required = array('title');
     parent::__construct('#__categories', 'id', $db);
 }
示例#8
0
 public static function isAuthorized()
 {
     // Initialize system variables
     $user =& JFactory::getUser();
     // Check the ACLs for Joomla! 1.5
     if (YireoHelper::isJoomla15() && !$user->authorize('com_simplelists', 'manage')) {
         return false;
         // Check the ACLs for Joomla! 1.6 and later
     } elseif (YireoHelper::isJoomla15() == false && $user->authorise('core.manage', 'com_simplelists') == false) {
         return false;
     }
     return true;
 }
示例#9
0
 public function getMenuItems()
 {
     static $items = null;
     if (empty($items)) {
         $component =& JComponentHelper::getComponent('com_simplelists');
         $menu =& JSite::getMenu();
         if (YireoHelper::isJoomla15()) {
             $items = $menu->getItems('componentid', $component->id);
         } else {
             $items = $menu->getItems('component_id', $component->id);
         }
     }
     return $items;
 }
示例#10
0
 public function display($tpl = null)
 {
     JResponse::allowCache(false);
     if (YireoHelper::isJoomla15()) {
         JHTML::_('stylesheet', 'popup-imagelist.css', 'administrator/components/com_media/assets/');
     } else {
         JHTML::_('stylesheet', 'popup-imagelist.css', 'media/media/css/');
     }
     JHTML::_('behavior.mootools');
     JHTML::_('behavior.modal');
     $this->assignRef('files', $this->get('files'));
     $this->assignRef('folders', $this->get('folders'));
     $this->assignRef('state', $this->get('state'));
     parent::display($tpl);
 }
示例#11
0
 /**
  * Method to display a print-icon
  *
  * @access public
  * @param null
  * @return string HTML output
  */
 public function print_popup()
 {
     // Construct the URL
     $url = 'index.php?option=com_simplelists&view=items';
     if (JRequest::getInt('category_id') > 0) {
         $url .= '&category_id=' . JRequest::getInt('category_id');
     }
     if (JRequest::getInt('Itemid') > 0) {
         $url .= '&Itemid=' . JRequest::getInt('Itemid');
     }
     $url .= '&tmpl=component';
     // Add JavaScript variables
     $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
     // Checks template image directory for image, if non found default are loaded
     $image_folder = YireoHelper::isJoomla15() ? '/images/M_images/' : '/media/system/images/';
     $text = JHTML::_('image.site', 'printButton.png', $image_folder, NULL, NULL, JText::_('Print'));
     // Construct the link-attributes
     $attribs['title'] = JText::_('Print');
     $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
     $attribs['rel'] = 'nofollow';
     return JHTML::_('link', JRoute::_($url), $text);
 }
示例#12
0
 public function getGridCell($type, $item, $i = 0, $n = 0)
 {
     $html = null;
     if ($type == 'reorder') {
         $field = $this->get('OrderByDefault');
         $ordering = $this->lists['order'] == $field;
         $disabled = $ordering ? '' : 'disabled="disabled"';
         $html .= '<span>' . $this->pagination->orderUpIcon($i, 1, 'orderup', 'Move Up', $ordering) . '</span>';
         $html .= '<span>' . $this->pagination->orderDownIcon($i, $n, 1, 'orderdown', 'Move Down', $ordering) . '</span>';
         $html .= '<input type="text" name="order[]" size="5" value="' . $item->{$field} . '" ' . $disabled . ' class="text_area" style="text-align: center" />';
     } else {
         if ($type == 'published') {
             if (YireoHelper::isJoomla15() == false) {
                 $html .= JHtml::_('jgrid.published', $item->published, $i, 'articles.', false, 'cb', $item->params->get('publish_up'), $item->params->get('publish_down'));
             } else {
                 $html .= JHTML::_('grid.published', $item, $i);
             }
         } else {
             if ($type == 'checked') {
                 $html .= JHTML::_('grid.checkedout', $item, $i);
             }
         }
     }
     return $html;
 }
示例#13
0
 /**
  * Method to parse a list of link-types into a HTML selectbox
  *
  * @access public
  * @param int $current
  * @return string HTML output
  */
 public function selectLinkType($current = '')
 {
     if (YireoHelper::isJoomla15()) {
         $query = 'SELECT name AS title, element AS value FROM #__plugins WHERE folder="simplelistslink" ORDER BY ordering';
     } else {
         $query = 'SELECT name AS title, element AS value FROM #__extensions WHERE type="plugin" AND folder="simplelistslink" ORDER BY ordering';
     }
     $db = JFactory::getDBO();
     $db->setQuery($query);
     $plugins = $db->loadObjectList();
     $options = array();
     $options[] = JHTML::_('select.option', '', '- ' . JText::_('COM_SIMPLELISTS_SELECT_LINKTYPE') . ' -', 'id', 'title');
     if (!empty($plugins)) {
         foreach ($plugins as $plugin) {
             $title = trim(preg_replace('/simplelists\\ \\-/i', '', $plugin->title));
             $options[] = JHTML::_('select.option', $plugin->value, $title, 'id', 'title');
         }
     }
     $javascript = 'onchange="document.adminForm.submit();"';
     return JHTML::_('select.genericlist', $options, 'filter_link_type', $javascript, 'id', 'title', $current);
 }
示例#14
0
 public function getMenuItem($category_id = 0, $layout = 'default')
 {
     static $menu_items;
     if (empty($menu_items)) {
         $component =& JComponentHelper::getComponent('com_simplelists');
         $menu =& JSite::getMenu();
         if (YireoHelper::isJoomla15()) {
             $menu_items = $menu->getItems('componentid', $component->id);
         } else {
             $menu_items = $menu->getItems('component_id', $component->id);
         }
     }
     $near_match = null;
     if (!empty($menu_items)) {
         foreach ($menu_items as $menu_item) {
             if (!empty($menu_item->query['category_id']) && !empty($menu_item->query['layout']) && $menu_item->query['category_id'] == $category_id && $menu_item->query['layout'] == $layout) {
                 return $menu_item;
             } elseif ($near_match == null && !empty($menu_item->query['category_id']) && $menu_item->query['category_id'] == $category_id) {
                 $near_match = $menu_item;
             }
         }
     }
     return $near_match;
 }
示例#15
0
$editor =& JFactory::getEditor();
echo $editor->display('description', $this->item->description, '100%', '300', '44', '9');
?>
                        </td>
                    </tr>
                </table>
            </fieldset>
        </td>
        <td width="480" valign="top" class="params">
            <?php 
$groups = array(array('params-category', 'Category', 'details'), array('params-layout', 'Layout', 'layout'), array('metadata-category', 'Metadata', 'metadata'));
echo $this->pane->startPane('content-pane');
foreach ($groups as $group) {
    $title = JText::_('Parameters') . ' (' . JText::_($group[1]) . ')';
    echo $this->pane->startPanel($title, $group[0]);
    if (YireoHelper::isJoomla15()) {
        echo $this->params->render('params', $group[2]);
    } else {
        foreach ($this->form->getFieldset($group[2]) as $field) {
            ?>
                        <dl>
                            <dt><?php 
            echo $field->label;
            ?>
</dt>
                            <dd><?php 
            echo $field->input;
            ?>
</dd>
                        <dl>
                        <?php 
示例#16
0
 public function isCheckedOut($item = null)
 {
     $user = JFactory::getUser();
     $table = $this->getModel()->getTable();
     if (YireoHelper::isJoomla15()) {
         return $table->isCheckedOut($user->get('id'), $item->checked_out);
     } else {
         return $table->isCheckedOut($user->get('id'), $item->checked_out);
     }
 }
示例#17
0
 /**
  * Check whether this record can be edited
  *
  * @access protected
  * @subpackage Yireo
  * @param array $data
  * @return bool
  */
 protected function canEditState($data)
 {
     // Joomla! 1.5 is unable to deal with this
     if (YireoHelper::isJoomla15()) {
         return true;
     }
     // Check the permissions for this edit.state action
     if ($this->getId() > 0) {
         return $this->user->authorise('core.edit.state', $this->_option . '.' . $this->_entity . '.' . (int) $this->getId());
     } else {
         return $this->user->authorise('core.edit.state', $this->_option);
     }
 }
示例#18
0
        $this->setFolder($i);
        echo $this->loadTemplate('default_folder');
    }
}
if (count($this->files) > 0) {
    for ($i = 0, $n = count($this->files); $i < $n; $i++) {
        $this->setFile($i);
        echo $this->loadTemplate('default_item');
    }
}
if (!is_readable(JPATH_SITE . DS . $base_path)) {
    $message = JText::_('Folder not readable');
} elseif (empty($this->files) && empty($this->folders)) {
    $message = JText::_('No files or folders found');
} elseif (empty($this->files)) {
    $message = JText::_('No files found');
}
if (!empty($message)) {
    echo '<div id="files-message">' . $message . '</div>';
}
?>
    </div>

	<input type="hidden" id="dirPath" name="dirPath" />
	<input type="hidden" id="f_file" name="f_file" />
	<input type="hidden" id="tmpl" name="component" />
</form>
<?php 
if (YireoHelper::isJoomla15() == false) {
    echo $this->loadTemplate('default_upload');
}
示例#19
0
 public function getInput($current = null)
 {
     if (YireoHelper::isJoomla15()) {
         $modal_link = 'index.php?option=com_content&amp;task=element&amp;tmpl=component';
     } else {
         $modal_link = 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;function=slSelectArticle';
     }
     return $this->getModal('article', $modal_link, $current);
 }
示例#20
0
 /**
  * Method to build the query ORDER BY segment
  *
  * @access protected
  * @subpackage Yireo
  * @param null
  * @return string
  */
 protected function buildQueryOrderBy()
 {
     if (YireoHelper::isJoomla15()) {
         $default_ordering = 'ordering';
     } else {
         $default_ordering = 'lft, rgt';
     }
     $orderby = $this->params->get('cat_orderby', $default_ordering);
     if ($orderby == 'alpha') {
         $this->addOrderBy('`category`.`title` ASC');
     } elseif ($orderby == 'ralpha') {
         $this->addOrderBy('`category`.`title` DESC');
     } else {
         if ($orderby == 'ordering') {
             $orderby = $default_ordering;
         }
         $this->addOrderBy('`category`.' . $orderby);
     }
     return parent::buildQueryOrderBy();
 }
示例#21
0
 public function isCheckedOut($item = null)
 {
     // If this item has no checked_out field, it's an easy choice
     if (isset($item->checked_out) == false) {
         return false;
     }
     // Import variables
     $user = JFactory::getUser();
     $table = $this->getModel()->getTable();
     if (YireoHelper::isJoomla15()) {
         return $table->isCheckedOut($user->get('id'), $item->checked_out);
     } else {
         return $table->isCheckedOut($user->get('id'), $item->checked_out);
     }
 }