예제 #1
0
파일: sql.php 프로젝트: vanie3/appland
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Initialize some field attributes.
     $key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
     $value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
     $translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
     $query = (string) $this->element['query'];
     // Get the database object.
     $db = MFactory::getDBO();
     // Set the query and get the result list.
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     // Check for an error.
     if ($db->getErrorNum()) {
         MError::raiseWarning(500, $db->getErrorMsg());
         return $options;
     }
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = MHtml::_('select.option', $item->{$key}, MText::_($item->{$value}));
             } else {
                 $options[] = MHtml::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
예제 #2
0
파일: combo.php 프로젝트: vanie3/appland
 protected function getInput()
 {
     // Initialize variables.
     $html = array();
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="combobox ' . (string) $this->element['class'] . '"' : ' class="combobox"';
     $attr .= (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     // Get the field options.
     $options = $this->getOptions();
     // Load the combobox behavior.
     MHtml::_('behavior.combobox');
     // Build the input for the combo box.
     $html[] = '<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $attr . '/>';
     // Build the list for the combo box.
     $html[] = '<ul id="combobox-' . $this->id . '" style="display:none;">';
     foreach ($options as $option) {
         $html[] = '<li>' . $option->text . '</li>';
     }
     $html[] = '</ul>';
     return implode($html);
 }
예제 #3
0
파일: integer.php 프로젝트: vanie3/appland
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Initialize some field attributes.
     $first = (int) $this->element['first'];
     $last = (int) $this->element['last'];
     $step = (int) $this->element['step'];
     // Sanity checks.
     if ($step == 0) {
         // Step of 0 will create an endless loop.
         return $options;
     } elseif ($first < $last && $step < 0) {
         // A negative step will never reach the last number.
         return $options;
     } elseif ($first > $last && $step > 0) {
         // A position step will never reach the last number.
         return $options;
     }
     // Build the options array.
     for ($i = $first; $i <= $last; $i += $step) {
         $options[] = MHtml::_('select.option', $i);
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
예제 #4
0
파일: sliders.php 프로젝트: vanie3/appland
 protected static function _loadBehavior($group, $params = array())
 {
     static $loaded = array();
     if (!array_key_exists($group, $loaded)) {
         $loaded[$group] = true;
         // Include mootools framework.
         MHtml::_('behavior.framework', true);
         $document = MFactory::getDocument();
         $display = isset($params['startOffset']) && isset($params['startTransition']) && $params['startTransition'] ? (int) $params['startOffset'] : null;
         $show = isset($params['startOffset']) && !(isset($params['startTransition']) && $params['startTransition']) ? (int) $params['startOffset'] : null;
         $options = '{';
         $opt['onActive'] = "function(toggler, i) {toggler.addClass('pane-toggler-down');" . "toggler.removeClass('pane-toggler');i.addClass('pane-down');i.removeClass('pane-hide');Cookie.write('jpanesliders_" . $group . "',\$\$('div#" . $group . ".pane-sliders > .panel > h3').indexOf(toggler));}";
         $opt['onBackground'] = "function(toggler, i) {toggler.addClass('pane-toggler');" . "toggler.removeClass('pane-toggler-down');i.addClass('pane-hide');i.removeClass('pane-down');if(\$\$('div#" . $group . ".pane-sliders > .panel > h3').length==\$\$('div#" . $group . ".pane-sliders > .panel > h3.pane-toggler').length) Cookie.write('jpanesliders_" . $group . "',-1);}";
         $opt['duration'] = isset($params['duration']) ? (int) $params['duration'] : 300;
         $opt['display'] = isset($params['useCookie']) && $params['useCookie'] ? MRequest::getInt('jpanesliders_' . $group, $display, 'cookie') : $display;
         $opt['show'] = isset($params['useCookie']) && $params['useCookie'] ? MRequest::getInt('jpanesliders_' . $group, $show, 'cookie') : $show;
         $opt['opacity'] = isset($params['opacityTransition']) && $params['opacityTransition'] ? 'true' : 'false';
         $opt['alwaysHide'] = isset($params['allowAllClose']) && !$params['allowAllClose'] ? 'false' : 'true';
         foreach ($opt as $k => $v) {
             if ($v) {
                 $options .= $k . ': ' . $v . ',';
             }
         }
         if (substr($options, -1) == ',') {
             $options = substr($options, 0, -1);
         }
         $options .= '}';
         $js = "jQuery(document).ready(function () { new Fx.Accordion(\$\$('div#" . $group . ".pane-sliders > .panel > h3.pane-toggler'), \$\$('div#" . $group . ".pane-sliders > .panel > div.pane-slider'), " . $options . "); });";
         $document->addScriptDeclaration($js);
     }
 }
예제 #5
0
 protected function getInput()
 {
     // Initialize variables.
     $options = array();
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     // Iterate through the children and build an array of options.
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $tmp = MHtml::_('select.option', (string) $option['value'], trim((string) $option), 'value', 'text', (string) $option['disabled'] == 'true');
         // Set some option attributes.
         $tmp->class = (string) $option['class'];
         // Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         // Add the option object to the result set.
         $options[] = $tmp;
     }
     return MHtml::_('access.usergroup', $this->name, $this->value, $attr, $options, $this->id);
 }
예제 #6
0
파일: tabs.php 프로젝트: vanie3/appland
 protected static function _loadBehavior($group, $params = array())
 {
     static $loaded = array();
     if (!array_key_exists((string) $group, $loaded)) {
         // Include MooTools framework
         MHtml::_('behavior.framework', true);
         $options = '{';
         $opt['onActive'] = isset($params['onActive']) ? $params['onActive'] : null;
         $opt['onBackground'] = isset($params['onBackground']) ? $params['onBackground'] : null;
         $opt['display'] = isset($params['startOffset']) ? (int) $params['startOffset'] : null;
         $opt['useStorage'] = isset($params['useCookie']) && $params['useCookie'] ? 'true' : 'false';
         $opt['titleSelector'] = "'dt.tabs'";
         $opt['descriptionSelector'] = "'dd.tabs'";
         foreach ($opt as $k => $v) {
             if ($v) {
                 $options .= $k . ': ' . $v . ',';
             }
         }
         if (substr($options, -1) == ',') {
             $options = substr($options, 0, -1);
         }
         $options .= '}';
         $js = ' jQuery(document).ready(function () {
                     $$(\'dl#' . $group . '.tabs\').each(function(tabs){
                         new MTabs(tabs, ' . $options . ');
                     });
                 });';
         $document = MFactory::getDocument();
         $document->addScriptDeclaration($js);
         MHtml::_('script', 'system/tabs.js', false, true);
         $loaded[(string) $group] = true;
     }
 }
예제 #7
0
파일: password.php 프로젝트: vanie3/appland
    protected function getInput()
    {
        // Initialize some field attributes.
        $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
        $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : '';
        $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
        $auto = (string) $this->element['autocomplete'] == 'off' ? ' autocomplete="off"' : '';
        $readonly = (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : '';
        $disabled = (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
        $meter = (string) $this->element['strengthmeter'] == 'true';
        $threshold = $this->element['threshold'] ? (int) $this->element['threshold'] : 66;
        $script = '';
        if ($meter) {
            MHtml::_('script', 'system/passwordstrength.js', true, true);
            $script = '<script type="text/javascript">new Form.PasswordStrength("' . $this->id . '",
				{
					threshold: ' . $threshold . ',
					onUpdate: function(element, strength, threshold) {
						element.set("data-passwordstrength", strength);
					}
				}
			);</script>';
        }
        return '<input type="password" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $auto . $class . $readonly . $disabled . $size . $maxLength . '/>' . $script;
    }
예제 #8
0
파일: menuitem.php 프로젝트: vanie3/appland
 protected function getGroups()
 {
     // Initialize variables.
     $groups = array();
     // Initialize some field attributes.
     $menuType = (string) $this->element['menu_type'];
     $published = $this->element['published'] ? explode(',', (string) $this->element['published']) : array();
     $disable = $this->element['disable'] ? explode(',', (string) $this->element['disable']) : array();
     $language = $this->element['language'] ? explode(',', (string) $this->element['language']) : array();
     // Get the menu items.
     $items = MenusHelper::getMenuLinks($menuType, 0, 0, $published, $language);
     // Build group for a specific menu type.
     if ($menuType) {
         // Initialize the group.
         $groups[$menuType] = array();
         // Build the options array.
         foreach ($items as $link) {
             $groups[$menuType][] = MHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
         }
     } else {
         // Build the groups arrays.
         foreach ($items as $menu) {
             // Initialize the group.
             $groups[$menu->menutype] = array();
             // Build the options array.
             foreach ($menu->links as $link) {
                 $groups[$menu->menutype][] = MHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable));
             }
         }
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
예제 #9
0
파일: calendar.php 프로젝트: vanie3/appland
 protected function getInput()
 {
     // Initialize some field attributes.
     $format = $this->element['format'] ? (string) $this->element['format'] : '%Y-%m-%d';
     // Build the attributes array.
     $attributes = array();
     if ($this->element['size']) {
         $attributes['size'] = (int) $this->element['size'];
     }
     if ($this->element['maxlength']) {
         $attributes['maxlength'] = (int) $this->element['maxlength'];
     }
     if ($this->element['class']) {
         $attributes['class'] = (string) $this->element['class'];
     }
     if ((string) $this->element['readonly'] == 'true') {
         $attributes['readonly'] = 'readonly';
     }
     if ((string) $this->element['disabled'] == 'true') {
         $attributes['disabled'] = 'disabled';
     }
     if ($this->element['onchange']) {
         $attributes['onchange'] = (string) $this->element['onchange'];
     }
     // Handle the special case for "now".
     if (strtoupper($this->value) == 'NOW') {
         $this->value = strftime($format);
     }
     // Get some system objects.
     $config = MFactory::getConfig();
     $user = MFactory::getUser();
     // If a known filter is given use it.
     switch (strtoupper((string) $this->element['filter'])) {
         case 'SERVER_UTC':
             // Convert a date to UTC based on the server timezone.
             if (intval($this->value)) {
                 // Get a date object based on the correct timezone.
                 $date = MFactory::getDate($this->value, 'UTC');
                 $date->setTimezone(new DateTimeZone($config->get('offset')));
                 // Transform the date string.
                 $this->value = $date->format('Y-m-d H:i:s', true, false);
             }
             break;
         case 'USER_UTC':
             // Convert a date to UTC based on the user timezone.
             if (intval($this->value)) {
                 // Get a date object based on the correct timezone.
                 $date = MFactory::getDate($this->value, 'UTC');
                 $date->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset'))));
                 // Transform the date string.
                 $this->value = $date->format('Y-m-d H:i:s', true, false);
             }
             break;
     }
     return MHtml::_('calendar', $this->value, $this->name, $this->id, $format, $attributes);
 }
예제 #10
0
파일: batch.php 프로젝트: vanie3/appland
 public static function user($noUser = true)
 {
     $optionNo = '';
     if ($noUser) {
         $optionNo = '<option value="0">' . MText::_('MLIB_HTML_BATCH_USER_NOUSER') . '</option>';
     }
     // Create the batch selector to select a user on a selection list.
     $lines = array('<label id="batch-user-lbl" for="batch-user" class="hasTip"' . ' title="' . MText::_('MLIB_HTML_BATCH_USER_LABEL') . '::' . MText::_('MLIB_HTML_BATCH_USER_LABEL_DESC') . '">', MText::_('MLIB_HTML_BATCH_USER_LABEL'), '</label>', '<select name="batch[user_id]" class="inputbox" id="batch-user-id">', '<option value="">' . MText::_('MLIB_HTML_BATCH_USER_NOCHANGE') . '</option>', $optionNo, MHtml::_('select.options', MHtml::_('user.userlist'), 'value', 'text'), '</select>');
     return implode("\n", $lines);
 }
예제 #11
0
파일: category.php 프로젝트: vanie3/appland
 protected function getOptions()
 {
     // Initialise variables.
     $options = array();
     $extension = $this->element['extension'] ? (string) $this->element['extension'] : (string) $this->element['scope'];
     $published = (string) $this->element['published'];
     $name = (string) $this->element['name'];
     // Load the category options for a given extension.
     if (!empty($extension)) {
         // Filter over published state or not depending upon if it is present.
         if ($published) {
             $options = MHtml::_('category.options', $extension, array('filter.published' => explode(',', $published)));
         } else {
             $options = MHtml::_('category.options', $extension);
         }
         // Verify permissions.  If the action attribute is set, then we scan the options.
         if ((string) $this->element['action']) {
             // Get the current user object.
             $user = MFactory::getUser();
             // For new items we want a list of categories you are allowed to create in.
             if (!$this->form->getValue($name)) {
                 foreach ($options as $i => $option) {
                     // To take save or create in a category you need to have create rights for that category
                     // unless the item is already in that category.
                     // Unset the option if the user isn't authorised for it. In this field assets are always categories.
                     if ($user->authorise('core.create', $extension . '.category.' . $option->value) != true) {
                         unset($options[$i]);
                     }
                 }
             } else {
                 $categoryOld = $this->form->getValue($name);
                 foreach ($options as $i => $option) {
                     // If you are only allowed to edit in this category but not edit.state, you should not get any
                     // option to change the category.
                     if ($user->authorise('core.edit.state', $extension . '.category.' . $categoryOld) != true) {
                         if ($option->value != $categoryOld) {
                             unset($options[$i]);
                         }
                     } elseif ($user->authorise('core.create', $extension . '.category.' . $option->value) != true && $option->value != $categoryOld) {
                         unset($options[$i]);
                     }
                 }
             }
         }
         if (isset($this->element['show_root'])) {
             array_unshift($options, MHtml::_('select.option', '0', MText::_('MGLOBAL_ROOT')));
         }
     } else {
         MError::raiseWarning(500, MText::_('MLIB_FORM_ERROR_FIELDS_CATEGORY_ERROR_EXTENSION_EMPTY'));
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
예제 #12
0
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Convert to name => name array.
     foreach (MCache::getStores() as $store) {
         $options[] = MHtml::_('select.option', $store, MText::_('MLIB_FORM_VALUE_CACHE_' . $store), 'value', 'text');
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
예제 #13
0
파일: confirm.php 프로젝트: vanie3/appland
 protected function _getCommand($msg, $name, $task, $list)
 {
     MHtml::_('behavior.framework');
     $message = MText::_('MLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
     $message = addslashes($message);
     if ($list) {
         $cmd = "if (document.adminForm.boxchecked.value==0){alert('{$message}');}else{if (confirm('{$msg}')){Miwi.submitbutton('{$task}');}}";
     } else {
         $cmd = "if (confirm('{$msg}')){Miwi.submitbutton('{$task}');}";
     }
     return $cmd;
 }
예제 #14
0
파일: user.php 프로젝트: vanie3/appland
 public static function groups($includeSuperAdmin = false)
 {
     if (!class_exists('WP_Roles')) {
         require_once ABSPATH . 'wp-includes/capabilities.php';
     }
     $wp_roles = new WP_Roles();
     $roles = $wp_roles->role_names;
     foreach ($roles as $key => $role) {
         $groups[] = MHtml::_('select.option', $key, $role);
     }
     return $groups;
 }
예제 #15
0
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Get the options from MSession.
     foreach (MSession::getStores() as $store) {
         $options[] = MHtml::_('select.option', $store, MText::_('MLIB_FORM_VALUE_SESSION_' . $store), 'value', 'text');
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
예제 #16
0
파일: view.php 프로젝트: vanie3/appland
 public function __construct($config = array())
 {
     // Set the view name
     if (empty($this->_name)) {
         if (array_key_exists('name', $config)) {
             $this->_name = $config['name'];
         } else {
             $this->_name = $this->getName();
         }
     }
     // Set the charset (used by the variable escaping functions)
     if (array_key_exists('charset', $config)) {
         $this->_charset = $config['charset'];
     }
     // User-defined escaping callback
     if (array_key_exists('escape', $config)) {
         $this->setEscape($config['escape']);
     }
     // Set a base path for use by the view
     if (array_key_exists('base_path', $config)) {
         $this->_basePath = $config['base_path'];
     } else {
         $this->_basePath = MPATH_COMPONENT;
     }
     // Set the default template search path
     if (array_key_exists('template_path', $config)) {
         // User-defined dirs
         $this->_setPath('template', $config['template_path']);
     } else {
         $this->_setPath('template', $this->_basePath . '/views/' . $this->getName() . '/tmpl');
     }
     // Set the default helper search path
     if (array_key_exists('helper_path', $config)) {
         // User-defined dirs
         $this->_setPath('helper', $config['helper_path']);
     } else {
         $this->_setPath('helper', $this->_basePath . '/helpers');
     }
     // Set the layout
     if (array_key_exists('layout', $config)) {
         $this->setLayout($config['layout']);
     } else {
         $this->setLayout('default');
     }
     $this->baseurl = MUri::base(true);
     MHtml::_('behavior.framework');
     if (MFactory::getApplication()->isAdmin()) {
         MHtml::_('behavior.modal');
     }
 }
예제 #17
0
 protected function getInput()
 {
     // Initialize variables.
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     // Get the field options.
     $options = $this->getOptions();
     return MHtml::_('access.level', $this->name, $this->value, $attr, $options, $this->id);
 }
예제 #18
0
파일: filelist.php 프로젝트: vanie3/appland
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Initialize some field attributes.
     $filter = (string) $this->element['filter'];
     $exclude = (string) $this->element['exclude'];
     $stripExt = (string) $this->element['stripext'];
     $hideNone = (string) $this->element['hide_none'];
     $hideDefault = (string) $this->element['hide_default'];
     // Get the path in which to search for file options.
     $path = (string) $this->element['directory'];
     if (!is_dir($path)) {
         $path = MPATH_ROOT . '/' . $path;
     }
     // Prepend some default options based on field attributes.
     if (!$hideNone) {
         $options[] = MHtml::_('select.option', '-1', MText::alt('MOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     }
     if (!$hideDefault) {
         $options[] = MHtml::_('select.option', '', MText::alt('MOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     }
     // Get a list of files in the search path with the given filter.
     $files = MFolder::files($path, $filter);
     // Build the options list from the list of files.
     if (is_array($files)) {
         foreach ($files as $file) {
             // Check to see if the file is in the exclude mask.
             if ($exclude) {
                 if (preg_match(chr(1) . $exclude . chr(1), $file)) {
                     continue;
                 }
             }
             // If the extension is to be stripped, do it.
             if ($stripExt) {
                 $file = MFile::stripExt($file);
             }
             $options[] = MHtml::_('select.option', $file, $file);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
예제 #19
0
파일: timezone.php 프로젝트: vanie3/appland
 protected function getGroups()
 {
     // Initialize variables.
     $groups = array();
     $keyField = $this->element['key_field'] ? (string) $this->element['key_field'] : 'id';
     $keyValue = $this->form->getValue($keyField);
     // If the timezone is not set use the server setting.
     if (strlen($this->value) == 0 && empty($keyValue)) {
         $this->value = MFactory::getConfig()->get('offset');
     }
     // Get the list of time zones from the server.
     $zones = DateTimeZone::listIdentifiers();
     // Build the group lists.
     foreach ($zones as $zone) {
         // Time zones not in a group we will ignore.
         if (strpos($zone, '/') === false) {
             continue;
         }
         // Get the group/locale from the timezone.
         list($group, $locale) = explode('/', $zone, 2);
         // Only use known groups.
         if (in_array($group, self::$zones)) {
             // Initialize the group if necessary.
             if (!isset($groups[$group])) {
                 $groups[$group] = array();
             }
             // Only add options where a locale exists.
             if (!empty($locale)) {
                 $groups[$group][$zone] = MHtml::_('select.option', $zone, str_replace('_', ' ', $locale), 'value', 'text', false);
             }
         }
     }
     // Sort the group lists.
     ksort($groups);
     foreach ($groups as $zone => &$location) {
         sort($location);
     }
     // Merge any additional groups in the XML definition.
     $groups = array_merge(parent::getGroups(), $groups);
     return $groups;
 }
예제 #20
0
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $tmp = MHtml::_('select.option', (string) $option['value'], trim((string) $option), 'value', 'text', (string) $option['disabled'] == 'true');
         // Set some option attributes.
         $tmp->class = (string) $option['class'];
         // Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         // Add the option object to the result set.
         $options[] = $tmp;
     }
     reset($options);
     return $options;
 }
예제 #21
0
파일: date.php 프로젝트: vanie3/appland
 public static function relative($date, $unit = null, $time = null)
 {
     if (is_null($time)) {
         // Get now
         $time = MFactory::getDate('now');
     }
     // Get the difference in seconds between now and the time
     $diff = strtotime($time) - strtotime($date);
     // Less than a minute
     if ($diff < 60) {
         return MText::_('MLIB_HTML_DATE_RELATIVE_LESSTHANAMINUTE');
     }
     // Round to minutes
     $diff = round($diff / 60);
     // 1 to 59 minutes
     if ($diff < 60 || $unit == 'minute') {
         return MText::plural('MLIB_HTML_DATE_RELATIVE_MINUTES', $diff);
     }
     // Round to hours
     $diff = round($diff / 60);
     // 1 to 23 hours
     if ($diff < 24 || $unit == 'hour') {
         return MText::plural('MLIB_HTML_DATE_RELATIVE_HOURS', $diff);
     }
     // Round to days
     $diff = round($diff / 24);
     // 1 to 6 days
     if ($diff < 7 || $unit == 'day') {
         return MText::plural('MLIB_HTML_DATE_RELATIVE_DAYS', $diff);
     }
     // Round to weeks
     $diff = round($diff / 7);
     // 1 to 4 weeks
     if ($diff <= 4 || $unit == 'week') {
         return MText::plural('MLIB_HTML_DATE_RELATIVE_WEEKS', $diff);
     }
     // Over a month, return the absolute time
     return MHtml::_('date', $date);
 }
예제 #22
0
파일: category.php 프로젝트: vanie3/appland
 public static function categories($extension, $config = array('filter.published' => array(0, 1)))
 {
     $hash = md5($extension . '.' . serialize($config));
     if (!isset(self::$items[$hash])) {
         $config = (array) $config;
         $db = MFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('a.id, a.title, a.level, a.parent_id');
         $query->from('#__categories AS a');
         $query->where('a.parent_id > 0');
         // Filter on extension.
         $query->where('extension = ' . $db->quote($extension));
         // Filter on the published state
         if (isset($config['filter.published'])) {
             if (is_numeric($config['filter.published'])) {
                 $query->where('a.published = ' . (int) $config['filter.published']);
             } elseif (is_array($config['filter.published'])) {
                 MArrayHelper::toInteger($config['filter.published']);
                 $query->where('a.published IN (' . implode(',', $config['filter.published']) . ')');
             }
         }
         $query->order('a.lft');
         $db->setQuery($query);
         $items = $db->loadObjectList();
         // Assemble the list options.
         self::$items[$hash] = array();
         foreach ($items as &$item) {
             $repeat = $item->level - 1 >= 0 ? $item->level - 1 : 0;
             $item->title = str_repeat('- ', $repeat) . $item->title;
             self::$items[$hash][] = MHtml::_('select.option', $item->id, $item->title);
         }
         // Special "Add to root" option:
         self::$items[$hash][] = MHtml::_('select.option', '1', MText::_('MLIB_HTML_ADD_TO_ROOT'));
     }
     return self::$items[$hash];
 }
예제 #23
0
 protected function getInput()
 {
     // Get the client id.
     $clientId = $this->element['client_id'];
     if (is_null($clientId) && $this->form instanceof MForm) {
         $clientId = $this->form->getValue('client_id');
     }
     $clientId = (int) $clientId;
     $client = MApplicationHelper::getClientInfo($clientId);
     // Get the module.
     $module = (string) $this->element['module'];
     if (empty($module) && $this->form instanceof MForm) {
         $module = $this->form->getValue('module');
     }
     $module = preg_replace('#\\W#', '', $module);
     // Get the template.
     $template = (string) $this->element['template'];
     $template = preg_replace('#\\W#', '', $template);
     // Get the style.
     if ($this->form instanceof MForm) {
         $template_style_id = $this->form->getValue('template_style_id');
     }
     $template_style_id = preg_replace('#\\W#', '', $template_style_id);
     // If an extension and view are present build the options.
     if ($module && $client) {
         // Load language file
         $lang = MFactory::getLanguage();
         $lang->load($module . '.sys', $client->path, null, false, false) || $lang->load($module . '.sys', $client->path . '/modules/' . $module, null, false, false) || $lang->load($module . '.sys', $client->path, $lang->getDefault(), false, false) || $lang->load($module . '.sys', $client->path . '/modules/' . $module, $lang->getDefault(), false, false);
         // Get the database object and a new query object.
         $db = MFactory::getDBO();
         $query = $db->getQuery(true);
         // Build the query.
         $query->select('element, name');
         $query->from('#__extensions as e');
         $query->where('e.client_id = ' . (int) $clientId);
         $query->where('e.type = ' . $db->quote('template'));
         $query->where('e.enabled = 1');
         if ($template) {
             $query->where('e.element = ' . $db->quote($template));
         }
         if ($template_style_id) {
             $query->join('LEFT', '#__template_styles as s on s.template=e.element');
             $query->where('s.id=' . (int) $template_style_id);
         }
         // Set the query and load the templates.
         $db->setQuery($query);
         $templates = $db->loadObjectList('element');
         // Check for a database error.
         if ($db->getErrorNum()) {
             MError::raiseWarning(500, $db->getErrorMsg());
         }
         // Build the search paths for module layouts.
         $module_path = MPath::clean($client->path . '/modules/' . $module . '/tmpl');
         // Prepare array of component layouts
         $module_layouts = array();
         // Prepare the grouped list
         $groups = array();
         // Add the layout options from the module path.
         if (is_dir($module_path) && ($module_layouts = MFolder::files($module_path, '^[^_]*\\.php$'))) {
             // Create the group for the module
             $groups['_'] = array();
             $groups['_']['id'] = $this->id . '__';
             $groups['_']['text'] = MText::sprintf('MOPTION_FROM_MODULE');
             $groups['_']['items'] = array();
             foreach ($module_layouts as $file) {
                 // Add an option to the module group
                 $value = MFile::stripExt($file);
                 $text = $lang->hasKey($key = strtoupper($module . '_LAYOUT_' . $value)) ? MText::_($key) : $value;
                 $groups['_']['items'][] = MHtml::_('select.option', '_:' . $value, $text);
             }
         }
         // Loop on all templates
         if ($templates) {
             foreach ($templates as $template) {
                 // Load language file
                 $lang->load('tpl_' . $template->element . '.sys', $client->path, null, false, false) || $lang->load('tpl_' . $template->element . '.sys', $client->path . '/templates/' . $template->element, null, false, false) || $lang->load('tpl_' . $template->element . '.sys', $client->path, $lang->getDefault(), false, false) || $lang->load('tpl_' . $template->element . '.sys', $client->path . '/templates/' . $template->element, $lang->getDefault(), false, false);
                 $template_path = MPath::clean($client->path . '/templates/' . $template->element . '/html/' . $module);
                 // Add the layout options from the template path.
                 if (is_dir($template_path) && ($files = MFolder::files($template_path, '^[^_]*\\.php$'))) {
                     foreach ($files as $i => $file) {
                         // Remove layout that already exist in component ones
                         if (in_array($file, $module_layouts)) {
                             unset($files[$i]);
                         }
                     }
                     if (count($files)) {
                         // Create the group for the template
                         $groups[$template->element] = array();
                         $groups[$template->element]['id'] = $this->id . '_' . $template->element;
                         $groups[$template->element]['text'] = MText::sprintf('MOPTION_FROM_TEMPLATE', $template->name);
                         $groups[$template->element]['items'] = array();
                         foreach ($files as $file) {
                             // Add an option to the template group
                             $value = MFile::stripExt($file);
                             $text = $lang->hasKey($key = strtoupper('TPL_' . $template->element . '_' . $module . '_LAYOUT_' . $value)) ? MText::_($key) : $value;
                             $groups[$template->element]['items'][] = MHtml::_('select.option', $template->element . ':' . $value, $text);
                         }
                     }
                 }
             }
         }
         // Compute attributes for the grouped list
         $attr = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
         // Prepare HTML code
         $html = array();
         // Compute the current selected values
         $selected = array($this->value);
         // Add a grouped list
         $html[] = MHtml::_('select.groupedlist', $groups, $this->name, array('id' => $this->id, 'group.id' => 'id', 'list.attr' => $attr, 'list.select' => $selected));
         return implode($html);
     } else {
         return '';
     }
 }
예제 #24
0
파일: rules.php 프로젝트: vanie3/appland
 public static function assetFormWidget($actions, $assetId = null, $parent = null, $control = 'mform[rules]', $idPrefix = 'mform_rules')
 {
     $images = self::_getImagesArray();
     // Get the user groups.
     $groups = self::_getUserGroups();
     // Get the incoming inherited rules as well as the asset specific rules.
     $inheriting = MAccess::getAssetRules($parent ? $parent : self::_getParentAssetId($assetId), true);
     $inherited = MAccess::getAssetRules($assetId, true);
     $rules = MAccess::getAssetRules($assetId);
     $html = array();
     $html[] = '<div class="acl-options">';
     $html[] = MHtml::_('tabs.start', 'acl-rules-' . $assetId, array('useCookie' => 1));
     $html[] = MHtml::_('tabs.panel', MText::_('MLIB_HTML_ACCESS_SUMMARY'), 'summary');
     $html[] = '			<p>' . MText::_('MLIB_HTML_ACCESS_SUMMARY_DESC') . '</p>';
     $html[] = '			<table class="aclsummary-table" summary="' . MText::_('MLIB_HTML_ACCESS_SUMMARY_DESC') . '">';
     $html[] = '			<caption>' . MText::_('MLIB_HTML_ACCESS_SUMMARY_DESC_CAPTION') . '</caption>';
     $html[] = '			<tr>';
     $html[] = '				<th class="col1 hidelabeltxt">' . MText::_('MLIB_RULES_GROUPS') . '</th>';
     foreach ($actions as $i => $action) {
         $html[] = '				<th class="col' . ($i + 2) . '">' . MText::_($action->title) . '</th>';
     }
     $html[] = '			</tr>';
     foreach ($groups as $i => $group) {
         $html[] = '			<tr class="row' . $i % 2 . '">';
         $html[] = '				<td class="col1">' . $group->text . '</td>';
         foreach ($actions as $j => $action) {
             $html[] = '				<td class="col' . ($j + 2) . '">' . ($assetId ? $inherited->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'] : ($inheriting->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'])) . '</td>';
         }
         $html[] = '			</tr>';
     }
     $html[] = ' 		</table>';
     foreach ($actions as $action) {
         $actionTitle = MText::_($action->title);
         $actionDesc = MText::_($action->description);
         $html[] = MHtml::_('tabs.panel', $actionTitle, $action->name);
         $html[] = '			<p>' . $actionDesc . '</p>';
         $html[] = '			<table class="aclmodify-table" summary="' . strip_tags($actionDesc) . '">';
         $html[] = '			<caption>' . MText::_('MLIB_HTML_ACCESS_MODIFY_DESC_CAPTION_ACL') . ' ' . $actionTitle . ' ' . MText::_('MLIB_HTML_ACCESS_MODIFY_DESC_CAPTION_TABLE') . '</caption>';
         $html[] = '			<tr>';
         $html[] = '				<th class="col1 hidelabeltxt">' . MText::_('MLIB_RULES_GROUP') . '</th>';
         $html[] = '				<th class="col2">' . MText::_('MLIB_RULES_INHERIT') . '</th>';
         $html[] = '				<th class="col3 hidelabeltxt">' . MText::_('MMODIFY') . '</th>';
         $html[] = '				<th class="col4">' . MText::_('MCURRENT') . '</th>';
         $html[] = '			</tr>';
         foreach ($groups as $i => $group) {
             $selected = $rules->allow($action->name, $group->value);
             $html[] = '			<tr class="row' . $i % 2 . '">';
             $html[] = '				<td class="col1">' . $group->text . '</td>';
             $html[] = '				<td class="col2">' . ($inheriting->allow($action->name, $group->identities) ? $images['allow-i'] : $images['deny-i']) . '</td>';
             $html[] = '				<td class="col3">';
             $html[] = '					<select id="' . $idPrefix . '_' . $action->name . '_' . $group->value . '" class="inputbox" size="1" name="' . $control . '[' . $action->name . '][' . $group->value . ']" title="' . MText::sprintf('MLIB_RULES_SELECT_ALLOW_DENY_GROUP', $actionTitle, $group->text) . '">';
             $html[] = '						<option value=""' . ($selected === null ? ' selected="selected"' : '') . '>' . MText::_('MLIB_RULES_INHERIT') . '</option>';
             $html[] = '						<option value="1"' . ($selected === true ? ' selected="selected"' : '') . '>' . MText::_('MLIB_RULES_ALLOWED') . '</option>';
             $html[] = '						<option value="0"' . ($selected === false ? ' selected="selected"' : '') . '>' . MText::_('MLIB_RULES_DENIED') . '</option>';
             $html[] = '					</select>';
             $html[] = '				</td>';
             $html[] = '				<td class="col4">' . ($assetId ? $inherited->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'] : ($inheriting->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'])) . '</td>';
             $html[] = '			</tr>';
         }
         $html[] = '			</table>';
     }
     $html[] = MHtml::_('tabs.end');
     // Build the footer with legend and special purpose buttons.
     $html[] = '	<div class="clr"></div>';
     $html[] = '	<ul class="acllegend fltlft">';
     $html[] = '		<li class="acl-allowed">' . MText::_('MLIB_RULES_ALLOWED') . '</li>';
     $html[] = '		<li class="acl-denied">' . MText::_('MLIB_RULES_DENIED') . '</li>';
     $html[] = '	</ul>';
     $html[] = '</div>';
     return implode("\n", $html);
 }
예제 #25
0
파일: access.php 프로젝트: vanie3/appland
 public static function assetgrouplist($name, $selected, $attribs = null, $config = array())
 {
     static $count;
     $options = MHtmlAccess::assetgroups();
     if (isset($config['title'])) {
         array_unshift($options, MHtml::_('select.option', '', $config['title']));
     }
     return MHtml::_('select.genericlist', $options, $name, array('id' => isset($config['id']) ? $config['id'] : 'assetgroups_' . ++$count, 'list.attr' => is_null($attribs) ? 'class="inputbox" size="3"' : $attribs, 'list.select' => (int) $selected));
 }
예제 #26
0
파일: rules.php 프로젝트: vanie3/appland
 protected function getInput()
 {
     MHtml::_('behavior.tooltip');
     // Initialise some field attributes.
     $section = $this->element['section'] ? (string) $this->element['section'] : '';
     $component = $this->element['component'] ? (string) $this->element['component'] : '';
     $assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id';
     // Get the actions for the asset.
     $actions = MAccess::getActions($component, $section);
     // Iterate over the children and add to the actions.
     foreach ($this->element->children() as $el) {
         if ($el->getName() == 'action') {
             $actions[] = (object) array('name' => (string) $el['name'], 'title' => (string) $el['title'], 'description' => (string) $el['description']);
         }
     }
     // Get the explicit rules for this asset.
     if ($section == 'component') {
         // Need to find the asset id by the name of the component.
         $db = MFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select($db->quoteName('id'));
         $query->from($db->quoteName('#__assets'));
         $query->where($db->quoteName('name') . ' = ' . $db->quote($component));
         $db->setQuery($query);
         $assetId = (int) $db->loadResult();
         if ($error = $db->getErrorMsg()) {
             MError::raiseNotice(500, $error);
         }
     } else {
         // Find the asset id of the content.
         // Note that for global configuration, com_config injects asset_id = 1 into the form.
         $assetId = $this->form->getValue($assetField);
     }
     // Use the compact form for the content rules (deprecated).
     //if (!empty($component) && $section != 'component') {
     //	return MHtml::_('rules.assetFormWidget', $actions, $assetId, $assetId ? null : $component, $this->name, $this->id);
     //}
     // Full width format.
     // Get the rules for just this asset (non-recursive).
     $assetRules = MAccess::getAssetRules($assetId);
     // Get the available user groups.
     $groups = $this->getUserGroups();
     // Build the form control.
     $curLevel = 0;
     // Prepare output
     $html = array();
     $html[] = '<div id="permissions-sliders" class="pane-sliders">';
     $html[] = '<p class="rule-desc">' . MText::_('MLIB_RULES_SETTINGS_DESC') . '</p>';
     $html[] = '<ul id="rules">';
     // Start a row for each user group.
     foreach ($groups as $group) {
         $difLevel = $group->level - $curLevel;
         if ($difLevel > 0) {
             $html[] = '<li><ul>';
         } elseif ($difLevel < 0) {
             $html[] = str_repeat('</ul></li>', -$difLevel);
         }
         $html[] = '<li>';
         $html[] = '<div class="panel">';
         $html[] = '<h3 class="pane-toggler title"><a href="javascript:void(0);"><span>';
         $html[] = str_repeat('<span class="level">|&ndash;</span> ', $curLevel = $group->level) . $group->text;
         $html[] = '</span></a></h3>';
         $html[] = '<div class="pane-slider content pane-hide">';
         $html[] = '<div class="mypanel">';
         $html[] = '<table class="group-rules">';
         $html[] = '<thead>';
         $html[] = '<tr>';
         $html[] = '<th class="actions" id="actions-th' . $group->value . '">';
         $html[] = '<span class="acl-action">' . MText::_('MLIB_RULES_ACTION') . '</span>';
         $html[] = '</th>';
         $html[] = '<th class="settings" id="settings-th' . $group->value . '">';
         $html[] = '<span class="acl-action">' . MText::_('MLIB_RULES_SELECT_SETTING') . '</span>';
         $html[] = '</th>';
         // The calculated setting is not shown for the root group of global configuration.
         $canCalculateSettings = $group->parent_id || !empty($component);
         if ($canCalculateSettings) {
             $html[] = '<th id="aclactionth' . $group->value . '">';
             $html[] = '<span class="acl-action">' . MText::_('MLIB_RULES_CALCULATED_SETTING') . '</span>';
             $html[] = '</th>';
         }
         $html[] = '</tr>';
         $html[] = '</thead>';
         $html[] = '<tbody>';
         foreach ($actions as $action) {
             $html[] = '<tr>';
             $html[] = '<td headers="actions-th' . $group->value . '">';
             $html[] = '<label class="hasTip" for="' . $this->id . '_' . $action->name . '_' . $group->value . '" title="' . htmlspecialchars(MText::_($action->title) . '::' . MText::_($action->description), ENT_COMPAT, 'UTF-8') . '">';
             $html[] = MText::_($action->title);
             $html[] = '</label>';
             $html[] = '</td>';
             $html[] = '<td headers="settings-th' . $group->value . '">';
             $html[] = '<select name="' . $this->name . '[' . $action->name . '][' . $group->value . ']" id="' . $this->id . '_' . $action->name . '_' . $group->value . '" title="' . MText::sprintf('MLIB_RULES_SELECT_ALLOW_DENY_GROUP', MText::_($action->title), trim($group->text)) . '">';
             $inheritedRule = MAccess::checkGroup($group->value, $action->name, $assetId);
             // Get the actual setting for the action for this group.
             $assetRule = $assetRules->allow($action->name, $group->value);
             // Build the dropdowns for the permissions sliders
             // The parent group has "Not Set", all children can rightly "Inherit" from that.
             $html[] = '<option value=""' . ($assetRule === null ? ' selected="selected"' : '') . '>' . MText::_(empty($group->parent_id) && empty($component) ? 'MLIB_RULES_NOT_SET' : 'MLIB_RULES_INHERITED') . '</option>';
             $html[] = '<option value="1"' . ($assetRule === true ? ' selected="selected"' : '') . '>' . MText::_('MLIB_RULES_ALLOWED') . '</option>';
             $html[] = '<option value="0"' . ($assetRule === false ? ' selected="selected"' : '') . '>' . MText::_('MLIB_RULES_DENIED') . '</option>';
             $html[] = '</select>&#160; ';
             // If this asset's rule is allowed, but the inherited rule is deny, we have a conflict.
             if ($assetRule === true && $inheritedRule === false) {
                 $html[] = MText::_('MLIB_RULES_CONFLICT');
             }
             $html[] = '</td>';
             // Build the Calculated Settings column.
             // The inherited settings column is not displayed for the root group in global configuration.
             if ($canCalculateSettings) {
                 $html[] = '<td headers="aclactionth' . $group->value . '">';
                 // This is where we show the current effective settings considering currrent group, path and cascade.
                 // Check whether this is a component or global. Change the text slightly.
                 if (MAccess::checkGroup($group->value, 'core.admin', $assetId) !== true) {
                     if ($inheritedRule === null) {
                         $html[] = '<span class="icon-16-unset">' . MText::_('MLIB_RULES_NOT_ALLOWED') . '</span>';
                     } elseif ($inheritedRule === true) {
                         $html[] = '<span class="icon-16-allowed">' . MText::_('MLIB_RULES_ALLOWED') . '</span>';
                     } elseif ($inheritedRule === false) {
                         if ($assetRule === false) {
                             $html[] = '<span class="icon-16-denied">' . MText::_('MLIB_RULES_NOT_ALLOWED') . '</span>';
                         } else {
                             $html[] = '<span class="icon-16-denied"><span class="icon-16-locked">' . MText::_('MLIB_RULES_NOT_ALLOWED_LOCKED') . '</span></span>';
                         }
                     }
                 } elseif (!empty($component)) {
                     $html[] = '<span class="icon-16-allowed"><span class="icon-16-locked">' . MText::_('MLIB_RULES_ALLOWED_ADMIN') . '</span></span>';
                 } else {
                     // Special handling for  groups that have global admin because they can't  be denied.
                     // The admin rights can be changed.
                     if ($action->name === 'core.admin') {
                         $html[] = '<span class="icon-16-allowed">' . MText::_('MLIB_RULES_ALLOWED') . '</span>';
                     } elseif ($inheritedRule === false) {
                         // Other actions cannot be changed.
                         $html[] = '<span class="icon-16-denied"><span class="icon-16-locked">' . MText::_('MLIB_RULES_NOT_ALLOWED_ADMIN_CONFLICT') . '</span></span>';
                     } else {
                         $html[] = '<span class="icon-16-allowed"><span class="icon-16-locked">' . MText::_('MLIB_RULES_ALLOWED_ADMIN') . '</span></span>';
                     }
                 }
                 $html[] = '</td>';
             }
             $html[] = '</tr>';
         }
         $html[] = '</tbody>';
         $html[] = '</table></div>';
         $html[] = '</div></div>';
         $html[] = '</li>';
     }
     $html[] = str_repeat('</ul></li>', $curLevel);
     $html[] = '</ul><div class="rule-notes">';
     if ($section == 'component' || $section == null) {
         $html[] = MText::_('MLIB_RULES_SETTING_NOTES');
     } else {
         $html[] = MText::_('MLIB_RULES_SETTING_NOTES_ITEM');
     }
     $html[] = '</div></div>';
     $js = "jQuery(document).ready(function () { new Fx.Accordion(\$\$('div#permissions-sliders.pane-sliders .panel h3.pane-toggler')," . "\$\$('div#permissions-sliders.pane-sliders .panel div.pane-slider'), {onActive: function(toggler, i) {toggler.addClass('pane-toggler-down');" . "toggler.removeClass('pane-toggler');i.addClass('pane-down');i.removeClass('pane-hide');Cookie.write('jpanesliders_permissions-sliders" . $component . "',\$\$('div#permissions-sliders.pane-sliders .panel h3').indexOf(toggler));}," . "onBackground: function(toggler, i) {toggler.addClass('pane-toggler');toggler.removeClass('pane-toggler-down');i.addClass('pane-hide');" . "i.removeClass('pane-down');}, duration: 300, display: " . MRequest::getInt('jpanesliders_permissions-sliders' . $component, 0, 'cookie') . ", show: " . MRequest::getInt('jpanesliders_permissions-sliders' . $component, 0, 'cookie') . ", alwaysHide:true, opacity: false}); });";
     MFactory::getDocument()->addScriptDeclaration($js);
     return implode("\n", $html);
 }
예제 #27
0
파일: list.php 프로젝트: vanie3/appland
 public static function category($name, $extension, $selected = null, $javascript = null, $order = null, $size = 1, $sel_cat = 1)
 {
     // Deprecation warning.
     MLog::add('MList::category is deprecated.', MLog::WARNING, 'deprecated');
     $categories = MHtml::_('category.options', $extension);
     if ($sel_cat) {
         array_unshift($categories, MHtml::_('select.option', '0', MText::_('MOPTION_SELECT_CATEGORY')));
     }
     $category = MHtml::_('select.genericlist', $categories, $name, 'class="inputbox" size="' . $size . '" ' . $javascript, 'value', 'text', $selected);
     return $category;
 }
예제 #28
0
 protected function getOptions()
 {
     // Merge any additional options in the XML definition.
     return array_merge(parent::getOptions(), MHtml::_('contentlanguage.existing'));
 }
예제 #29
0
파일: menu.php 프로젝트: vanie3/appland
 public static function linkoptions($all = false, $unassigned = false)
 {
     $db = MFactory::getDbo();
     $query = $db->getQuery(true);
     // get a list of the menu items
     $query->select('m.id, m.parent_id, m.title, m.menutype');
     $query->from($db->quoteName('#__menu') . ' AS m');
     $query->where($db->quoteName('m.published') . ' = 1');
     $query->order('m.menutype, m.parent_id, m.ordering');
     $db->setQuery($query);
     $mitems = $db->loadObjectList();
     // Check for a database error.
     if ($db->getErrorNum()) {
         MError::raiseNotice(500, $db->getErrorMsg());
     }
     if (!$mitems) {
         $mitems = array();
     }
     $mitems_temp = $mitems;
     // Establish the hierarchy of the menu
     $children = array();
     // First pass - collect children
     foreach ($mitems as $v) {
         $pt = $v->parent_id;
         $list = @$children[$pt] ? $children[$pt] : array();
         array_push($list, $v);
         $children[$pt] = $list;
     }
     // Second pass - get an indent list of the items
     $list = MHtmlMenu::TreeRecurse(intval($mitems[0]->parent_id), '', array(), $children, 9999, 0, 0);
     // Code that adds menu name to Display of Page(s)
     $mitems = array();
     if ($all | $unassigned) {
         $mitems[] = MHtml::_('select.option', '<OPTGROUP>', MText::_('MOPTION_MENUS'));
         if ($all) {
             $mitems[] = MHtml::_('select.option', 0, MText::_('MALL'));
         }
         if ($unassigned) {
             $mitems[] = MHtml::_('select.option', -1, MText::_('MOPTION_UNASSIGNED'));
         }
         $mitems[] = MHtml::_('select.option', '</OPTGROUP>');
     }
     $lastMenuType = null;
     $tmpMenuType = null;
     foreach ($list as $list_a) {
         if ($list_a->menutype != $lastMenuType) {
             if ($tmpMenuType) {
                 $mitems[] = MHtml::_('select.option', '</OPTGROUP>');
             }
             $mitems[] = MHtml::_('select.option', '<OPTGROUP>', $list_a->menutype);
             $lastMenuType = $list_a->menutype;
             $tmpMenuType = $list_a->menutype;
         }
         $mitems[] = MHtml::_('select.option', $list_a->id, $list_a->title);
     }
     if ($lastMenuType !== null) {
         $mitems[] = MHtml::_('select.option', '</OPTGROUP>');
     }
     return $mitems;
 }
예제 #30
0
파일: select.php 프로젝트: vanie3/appland
 public static function integerlist($start, $end, $inc, $name, $attribs = null, $selected = null, $format = '')
 {
     // Set default options
     $options = array_merge(MHtml::$formatOptions, array('format.depth' => 0, 'option.format' => '', 'id' => null));
     if (is_array($attribs) && func_num_args() == 5) {
         // Assume we have an options array
         $options = array_merge($options, $attribs);
         // Extract the format and remove it from downstream options
         $format = $options['option.format'];
         unset($options['option.format']);
     } else {
         // Get options from the parameters
         $options['list.attr'] = $attribs;
         $options['list.select'] = $selected;
     }
     $start = intval($start);
     $end = intval($end);
     $inc = intval($inc);
     $data = array();
     for ($i = $start; $i <= $end; $i += $inc) {
         $data[$i] = $format ? sprintf($format, $i) : $i;
     }
     // Tell genericlist() to use array keys
     $options['option.key'] = null;
     return MHtml::_('select.genericlist', $data, $name, $options);
 }