/**
	 * Test the getInput method.
	 *
	 * @return  void
	 *
	 * @since   12.1
	 */
	public function testGetInput()
	{
		$form = new JFormInspector('form1');

		$this->assertThat(
			$form->load('<form><field name="folderlist" type="folderlist" /></form>'),
			$this->isTrue(),
			'Line:' . __LINE__ . ' XML string should load successfully.'
		);

		$field = new JFormFieldFolderList($form);

		$this->assertThat(
			$field->setup($form->getXml()->field, 'value'),
			$this->isTrue(),
			'Line:' . __LINE__ . ' The setup method should return true.'
		);

		$this->assertThat(
			strlen($field->input),
			$this->greaterThan(0),
			'Line:' . __LINE__ . ' The getInput method should return something without error.'
		);

		// TODO: Should check all the attributes have come in properly.
	}
Example #2
0
 /**
  * Method to get the list of files for the field options.
  * Specify the target directory with a directory attribute
  * Attributes allow an exclude mask and stripping of extensions from file name.
  * Default attribute may optionally be set to null (no file) or -1 (use a default).
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $table = JTable::getInstance('Style', 'TemplatesTable', array());
     $table->load((int) JFactory::getApplication()->input->getInt('id'));
     // update path to this template
     $path = (string) $this->element['directory'];
     if (!is_dir($path)) {
         // process path in template
         $options = array();
         $vals = array();
         // get all path in template
         $paths = T3Path::getAllPath($path);
         foreach ($paths as $path) {
             $this->directory = $this->element['directory'] = $path;
             $tmps = parent::getOptions();
             foreach ($tmps as $tmp) {
                 if (in_array($tmp->value, $vals)) {
                     continue;
                 }
                 $vals[] = $tmp->value;
                 $options[] = $tmp;
             }
         }
         return $options;
     }
     return parent::getOptions();
 }
Example #3
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  */
 protected function getOptions()
 {
     $view = $this->element['view'] ? $this->element['view'] : 'list';
     if (FabrikWorker::j3()) {
         $this->element['directory'] = $this->directory = '/components/com_fabrik/views/' . $view . '/tmpl/';
     } else {
         $this->element['directory'] = '/components/com_fabrik/views/' . $view . '/tmpl25/';
     }
     return parent::getOptions();
 }
Example #4
0
 /**
  * Method to get the list of files for the field options.
  * Specify the target directory with a directory attribute
  * Attributes allow an exclude mask and stripping of extensions from file name.
  * Default attribute may optionally be set to null (no file) or -1 (use a default).
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $table = JTable::getInstance('Style', 'TemplatesTable', array());
     $table->load((int) JFactory::getApplication()->input->getInt('id'));
     // update path to this template
     $path = (string) $this->element['directory'];
     if (!is_dir($path)) {
         $this->element['directory'] = PLAZART_TEMPLATE_PATH . DIRECTORY_SEPARATOR . $path;
     }
     return parent::getOptions();
 }
 /**
  * Method to get the list of files for the field options.
  * Specify the target directory with a directory attribute
  * Attributes allow an exclude mask and stripping of extensions from file name.
  * Default attribute may optionally be set to null (no file) or -1 (use a default).
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $path = (string) $this->element['directory'];
     if (!is_dir($path)) {
         $this->element['directory'] = JPATH_SITE . DIRECTORY_SEPARATOR . $path;
     }
     // Get the path in which to search for file options.
     $directory = (string) $this->element['directory'];
     $directory = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $directory);
     $this->directory = $directory;
     return parent::getOptions();
 }
Example #6
0
 /**
  * Method to get the list of files for the field options.
  * Specify the target directory with a directory attribute
  * Attributes allow an exclude mask and stripping of extensions from file name.
  * Default attribute may optionally be set to null (no file) or -1 (use a default).
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $table = JTable::getInstance('Style', 'TemplatesTable', array());
     $table->load((int) JFactory::getApplication()->input->getInt('id'));
     // update path to this template
     $path = (string) $this->element['directory'];
     if (!is_dir($path)) {
         $this->directory = $this->element['directory'] = T3_TEMPLATE_PATH . DIRECTORY_SEPARATOR . $path;
     }
     if (!is_dir($this->element['directory'])) {
         $hideDefault = (string) $this->element['hide_default'];
         if (!$hideDefault) {
             $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
         }
         return $options;
     }
     return parent::getOptions();
 }
Example #7
0
 /**
  * Method to get the list of files for the field options.
  * Specify the target directory with a directory attribute
  * Attributes allow an exclude mask and stripping of extensions from file name.
  * Default attribute may optionally be set to null (no file) or -1 (use a default).
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $table = JTable::getInstance('Style', 'TemplatesTable', array());
     $table->load((int) JFactory::getApplication()->input->getInt('id'));
     // update path to this template
     $path = (string) $this->element['directory'];
     if (!is_dir($path)) {
         $this->element['directory'] = PLAZART_TEMPLATE_PATH . DIRECTORY_SEPARATOR . $path;
     }
     $this->filter = (string) $this->element['filter'];
     $this->exclude = (string) $this->element['exclude'];
     $hideNone = (string) $this->element['hide_none'];
     $this->hideNone = $hideNone == 'true' || $hideNone == 'hideNone' || $hideNone == '1';
     $hideDefault = (string) $this->element['hide_default'];
     $this->hideDefault = $hideDefault == 'true' || $hideDefault == 'hideDefault' || $hideDefault == '1';
     // Get the path in which to search for file options.
     $this->directory = (string) $this->element['directory'];
     return parent::getOptions();
 }
Example #8
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  */
 protected function getOptions()
 {
     $view = $this->element['view'] ? $this->element['view'] : 'list';
     $dir = JPATH_ROOT . '/components/com_fabrik/views/' . $view . '/tmpl/';
     $dir = str_replace('\\', '/', $dir);
     $dir = str_replace('//', '/', $dir);
     if (FabrikWorker::j3()) {
         $this->element['directory'] = $this->directory = $dir;
     } else {
         $this->element['directory'] = '/components/com_fabrik/views/' . $view . '/tmpl25/';
     }
     $opts = parent::getOptions();
     foreach ($opts as &$opt) {
         $opt->value = str_replace('\\', '/', $opt->value);
         $opt->value = str_replace('//', '/', $opt->value);
         $opt->value = str_replace($dir, '', $opt->value);
         $opt->text = str_replace('\\', '/', $opt->text);
         $opt->text = str_replace('//', '/', $opt->text);
         $opt->text = str_replace($dir, '', $opt->text);
     }
     return $opts;
 }