Exemple #1
0
 protected function getLabel()
 {
     if (count($this->getOptions()) == 0) {
         return "<label><strong>There are no Social Channels configured and published to display</strong></label>";
     }
     return parent::getLabel();
 }
 /**
  * Method to get the field input markup for check boxes.
  *
  * @return string The field input markup.
  *
  * @since       1.0.0
  */
 protected function getInput()
 {
     // Get the field options.
     $options = $this->getOptions();
     if (empty($options)) {
         return '<span class="readonly">' . JText::_('COM_FIELDSANDFILTERS_ERROR_FIELD_VALUES_EMPTY') . '</span>';
     }
     return parent::getInput();
 }
 protected function getOptions()
 {
     AImporter::helper('vehicle');
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select('id AS value, title AS text');
     $query->from('#__bookpro_vehicle');
     $query->where('state = 1');
     $db->setQuery($query);
     $options = array();
     $options = $db->loadObjectList();
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 /**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  */
 protected function getOptions()
 {
     $document = JFactory::getDocument();
     $language = $document->getLanguage();
     $merchantCategories = BFCHelper::getMerchantCategories();
     $options = array();
     if ($merchantCategories) {
         foreach ($merchantCategories as $merchantCategory) {
             $currOpt = JHtml::_('select.option', $merchantCategory->MerchantCategoryId, BFCHelper::getLanguage($merchantCategory->Name, $language));
             $currOpt->checked = null;
             $options[] = $currOpt;
         }
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Exemple #5
0
 /**
  * Method to get certain otherwise inaccessible properties from the form field object.
  *
  * @param   string  $name  The property name for which to the the value.
  *
  * @return  mixed  The property value or null.
  *
  * @since   2.0
  */
 public function __get($name)
 {
     switch ($name) {
         case 'static':
             if (empty($this->static)) {
                 $this->static = $this->getStatic();
             }
             return $this->static;
             break;
         case 'repeatable':
             if (empty($this->repeatable)) {
                 $this->repeatable = $this->getRepeatable();
             }
             return $this->repeatable;
             break;
         default:
             return parent::__get($name);
     }
 }
 protected function getOptions()
 {
     $options = array();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('c.title AS text, c.id AS value,c.template_id');
     $query->from('#__tz_portfolio_plus_categories AS c');
     $query->where('extension = "com_tz_portfolio_plus"');
     //        $query -> join('LEFT','#__tz_portfolio_plus_categories AS tc ON tc.catid = c.id');
     $db->setQuery($query);
     if ($rows = $db->loadObjectList()) {
         foreach ($rows as $option) {
             $tmp = JHtml::_('select.option', (string) $option->value, trim($option->text), 'value', 'text');
             $checked = false;
             $app = JFactory::getApplication();
             $input = $app->input;
             $curTemplateId = null;
             if (!isset($this->element['template_id'])) {
                 if ($input->get('option') == 'com_tz_portfolio_plus' && $input->get('view') == 'template_style') {
                     $curTemplateId = $input->get('id');
                 }
             } else {
                 $curTemplateId = $this->element['template_id'];
             }
             if (isset($option->template_id) && $option->template_id && !empty($option->template_id)) {
                 if ($option->template_id == $curTemplateId) {
                     $checked = true;
                 }
             }
             $checked = $checked == 'true' || $checked == 'checked' || $checked == '1';
             // Set some option attributes.
             $tmp->checked = $checked;
             // Add the option object to the result set.
             $options[] = $tmp;
         }
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Exemple #7
0
    /**
     * Test forcemultiple property setup by JFormField::setup method
     *
     * @covers JFormField::setup
     * @covers JFormField::__get
     *
     * @return void
     */
    public function testSetupForceMultiple()
    {
        $field = new JFormFieldCheckboxes();
        $element = simplexml_load_string('
			<field type="checkboxes" name="myName">
				<option value="red">Red</option>
				<option value="blue">Blue</option>
			</field>
		');
        $field->forceMultiple = true;
        $this->assertThat($field->setup($element, 'Comment'), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true if successful.');
        $this->assertThat($field->multiple, $this->isTrue(), 'Line:' . __LINE__ . ' The property should be setted true forcefully.');
        $this->assertThat($field->name, $this->equalTo('myName[]'), 'Line:' . __LINE__ . ' The property should be computed from the XML.');
    }
 /**
  * Get the rendering of this field type for static display, e.g. in a single
  * item view (typically a "read" task).
  *
  * @since 2.0
  *
  * @return  string  The field HTML
  */
 public function getInput()
 {
     // Used for J! 2.5 compatibility
     $this->value = !is_array($this->value) ? explode(',', $this->value) : $this->value;
     return parent::getInput();
 }
 /**
  * Method to get the custom field options.
  * Use the query attribute to supply a query to generate the list.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $options = array();
     // Initialize some field attributes.
     $key = $this->keyField;
     $value = $this->valueField;
     // Get the database object.
     $db = JFactory::getDbo();
     // Set the query and get the result list.
     $db->setQuery($this->query);
     $items = $db->loadObjectlist();
     // Build the field options.
     if (!empty($items)) {
         //var_dump($items);
         foreach ($items as &$item) {
             if ($this->translate == true) {
                 $temp = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
             } else {
                 $temp = JHtml::_('select.option', $item->{$key}, $item->{$value});
             }
             $temp->checked = false;
             $options[] = $temp;
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since       1.0.0
  */
 protected function getOptions()
 {
     $options = array();
     if ($fieldID = (int) $this->form->getValue($this->parentField)) {
         $options = JHtml::_('FieldsandfiltersHtml.options.fieldValues', $fieldID, $this->states);
         // Load the plugin extension.
         if (empty($options)) {
             return false;
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Exemple #11
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $app = JFactory::getApplication();
     // prepare query
     $_db = JFactory::getDbo();
     $query = $_db->getQuery(true);
     $query->select("a.id AS value, a.title AS text, a.description as description, a.access AS access, a.published AS published, a.archive_flag AS archived");
     $query->from('#__bwpostman_mailinglists AS a');
     $query->where($_db->quoteName('a.archive_flag') . ' = ' . (int) 0);
     // Join over the asset groups.
     $query->select('ag.title AS access_level');
     $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
     $query->order($_db->quoteName('text') . 'ASC');
     $_db->setQuery($query);
     $options = $_db->loadObjectList();
     // Check for a database error.
     if ($_db->getErrorNum()) {
         $app->enqueueMessage($_db->getErrorMsg(), 'error');
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Exemple #12
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $app = JFactory::getApplication();
     // prepare query
     $_db = JFactory::getDbo();
     $query = $_db->getQuery(true);
     $sub_query = $_db->getQuery(true);
     // Build sub query which counts the newsletters of each campaign and query
     $sub_query->select('COUNT(' . $_db->quoteName('b') . '.' . $_db->quoteName('id') . ') AS ' . $_db->quoteName('newsletters'));
     $sub_query->from($_db->quoteName('#__bwpostman_newsletters') . 'AS ' . $_db->quoteName('b'));
     $sub_query->where($_db->quoteName('b') . '.' . $_db->quoteName('archive_flag') . ' = ' . (int) 0);
     $sub_query->where($_db->quoteName('b') . '.' . $_db->quoteName('campaign_id') . ' = ' . $_db->quoteName('a') . '.' . $_db->quoteName('id'));
     $query->select("a.id AS value, a.title AS text, a.description as description, a.archive_flag AS archived" . ', (' . $sub_query . ') AS newsletters');
     $query->from('#__bwpostman_campaigns AS a');
     $query->where($_db->quoteName('a.archive_flag') . ' = ' . (int) 0);
     // Join over the asset groups.
     $query->select('ag.title AS access_level');
     $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
     $query->order($_db->quoteName('text') . 'ASC');
     $_db->setQuery($query);
     $options = $_db->loadObjectList();
     // Check for a database error.
     if ($_db->getErrorNum()) {
         $app->enqueueMessage($_db->getErrorMsg(), 'error');
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Exemple #13
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   1.2.0
  */
 protected function getOptions()
 {
     // Hash for caching
     $hash = md5($this->element);
     if (!isset(static::$options[$hash])) {
         static::$options[$hash] = parent::getOptions();
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select('CONCAT("-",a.id) AS value')->select('a.title AS text')->select('COUNT(DISTINCT b.id) AS level')->from('#__usergroups as a')->join('LEFT', '#__usergroups  AS b ON a.lft > b.lft AND a.rgt < b.rgt')->group('a.id, a.title, a.lft, a.rgt')->order('a.lft ASC');
         $db->setQuery($query);
         if ($options = $db->loadObjectList()) {
             foreach ($options as &$option) {
                 $option->text = str_repeat('- ', $option->level) . $option->text;
             }
             static::$options[$hash] = array_merge(static::$options[$hash], $options);
         }
     }
     return static::$options[$hash];
 }
Exemple #14
0
 protected function getInput()
 {
     JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php");
     JEVHelper::ConditionalFields($this->element, $this->form->getName());
     return parent::getInput();
 }