예제 #1
0
파일: client.php 프로젝트: ForAEdesWeb/AEW4
 /**
  * Method to get the field input markup.
  *
  * @return  string	The field input markup.
  */
 protected function getInput()
 {
     $attributes = '';
     // To avoid user's confusion, readonly="true" should imply disabled="true".
     if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') {
         $attributes .= ' disabled="disabled"';
     }
     if ($v = (string) $this->element['onchange']) {
         $attributes .= ' onchange="' . $v . '"';
     }
     $attributes .= ' class="' . (string) $this->element['class'] . ' iconlist-16-' . $this->value . '"';
     $options = array();
     foreach ($this->element->children() as $option) {
         $options[] = JHtml::_('select.option', $option->attributes('value'), JText::_(trim($option)), array('option.attr' => 'attributes', 'attr' => ''));
     }
     $options[] = JHtml::_('select.option', 'site', JText::_('COM_LOCALISE_OPTION_CLIENT_SITE'), array('option.attr' => 'attributes', 'attr' => 'class="iconlist-16-site"'));
     $options[] = JHtml::_('select.option', 'administrator', JText::_('COM_LOCALISE_OPTION_CLIENT_ADMINISTRATOR'), array('option.attr' => 'attributes', 'attr' => 'class="iconlist-16-administrator"'));
     if (LocaliseHelper::hasInstallation()) {
         $options[] = JHtml::_('select.option', 'installation', JText::_('COM_LOCALISE_OPTION_CLIENT_INSTALLATION'), array('option.attr' => 'attributes', 'attr' => 'class="iconlist-16-installation"'));
     }
     $return = array();
     if ((string) $this->element['readonly'] == 'true') {
         $return[] = JHtml::_('select.genericlist', $options, '', array('id' => $this->id, 'list.select' => $this->value, 'option.attr' => 'attributes', 'list.attr' => $attributes));
         $return[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '"/>';
     } else {
         $return[] = JHtml::_('select.genericlist', $options, $this->name, array('id' => $this->id, 'list.select' => $this->value, 'option.attr' => 'attributes', 'list.attr' => $attributes));
     }
     return implode($return);
 }
예제 #2
0
 /**
  * Get all languages (according to filters)
  *
  * @return   array  array of object items
  */
 protected function getLanguages()
 {
     if (!isset($this->languages)) {
         $this->languages = array();
         $client = $this->getState('filter.client');
         $tag = $this->getState('filter.tag');
         $search = $this->getState('filter.search');
         if (empty($client)) {
             $clients = array('site', 'administrator');
             if (LocaliseHelper::hasInstallation()) {
                 $clients[] = 'installation';
             }
         } else {
             $clients = array($client);
         }
         foreach ($clients as $client) {
             if (empty($tag)) {
                 $folders = JFolder::folders(constant('LOCALISEPATH_' . strtoupper($client)) . '/language', '.', false, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'pdf_fonts', 'overrides'));
             } else {
                 $folders = JFolder::folders(constant('LOCALISEPATH_' . strtoupper($client)) . '/language', '^' . $tag . '$', false, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'pdf_fonts', 'overrides'));
             }
             foreach ($folders as $folder) {
                 //move to first
                 $id = LocaliseHelper::getFileId(constant('LOCALISEPATH_' . strtoupper($client)) . "/language/{$folder}/{$folder}.xml");
                 //if it was not found a file.
                 if ($id < 1) {
                     continue;
                 }
                 $model = JModelLegacy::getInstance('Language', 'LocaliseModel', array('ignore_request' => true));
                 $model->setState('language.tag', $folder);
                 $model->setState('language.client', $client);
                 $model->setState('language.id', $id);
                 $language = $model->getItem();
                 if (empty($search) || preg_match("/{$search}/i", $language->name)) {
                     $this->languages[] = $language;
                 }
             }
         }
         $ordering = $this->getState('list.ordering') ? $this->getState('list.ordering') : 'name';
         JArrayHelper::sortObjects($this->languages, $ordering, $this->getState('list.direction') == 'desc' ? -1 : 1);
     }
     return $this->languages;
 }