PHP JFormField Code Examples

PHP JFormField - 30 examples found. These are the top rated real world PHP examples of JFormField extracted from open source projects. You can rate examples to help us improve the quality of examples
 public function setup(&$element, $value, $group = null)
 {
     parent::setup($element, $value, $group);
     $this->joomla_field = new RokCommon_Form_JoomlaFieldWrapper($element, $group, $value, $this->name, $this->id);
     if ($this->joomla_field === false) {
         return false;
     }
     $this->joomla_field->setRokCommonForm($this->form);
     return true;
 }
Example #2
0
 public function __construct(JForm $form = null)
 {
     parent::__construct($form);
     static $resources = true;
     if ($resources) {
         $resources = false;
         $name = basename(realpath(dirname(__FILE__) . "/../.."));
         $document = JFactory::getDocument();
         // $this->element is not ready on the constructor
         //$type = (string)$this->element["type"];
         $type = strtolower($this->type);
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
             $document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $type . "&type=js");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
         }
         $scope = JFactory::getApplication()->scope;
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $scope . ".js")) {
             $document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $scope . "&type=js");
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $scope . ".css")) {
             $document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $scope . ".css");
         }
     }
 }
Example #3
0
 function __construct()
 {
     $plugin = JPluginHelper::getPlugin('system', 'minicck');
     $this->pluginParams = !empty($plugin->params) ? json_decode($plugin->params) : new stdClass();
     $this->fields = !empty($this->pluginParams->customfields) ? $this->pluginParams->customfields : array();
     parent::__construct();
 }
Example #4
0
	protected function getInput() {
	
		$tc = 'phocadownload';
		$ts = 'media/com_'.$tc.'/css/administrator/';
		$ti = 'media/com_'.$tc.'/images/administrator/';
		JHTML::stylesheet( $ts.'/'.$tc.'options.css' );
		echo '<div style="clear:both;"></div>';
		$phocaImage	= ( (string)$this->element['phocaimage'] ? $this->element['phocaimage'] : '' );
		$image 		= '';
		
		if ($phocaImage != ''){
			$image 	= JHTML::_('image', $ti . $phocaImage, '' );
		}
		
		if ($this->element['default']) {
			if ($image != '') {
				return '<div class="ph-options-head-expert">'
				.'<div>'. $image.' <strong>'. JText::_($this->element['default']) . '</strong></div>'
				.'</div>';
			} else {
				return '<div class="ph-options-head-expert">'
				.'<strong>'. JText::_($this->element['default']) . '</strong>'
				.'</div>';
			}
		} else {
			return parent::getLabel();
		}
		echo '<div style="clear:both;"></div>';
	}
Example #5
0
 protected function getLabel()
 {
     if ($this->form->jevdata[$this->name]["repeatId"] == 0) {
         return parent::getLabel();
     }
     return "";
 }
Example #6
0
 protected function getLabel()
 {
     $name = basename(realpath(dirname(__FILE__) . '/' . '..' . '/' . '..'));
     $direction = intval(JFactory::getLanguage()->get('rtl', 0));
     $left = $direction ? "right" : "left";
     $right = $direction ? "left" : "right";
     $class = version_compare(JVERSION, '2.5', 'gt') ? '3x' : '25';
     echo '<div class="clr"></div>';
     $image = '';
     $icon = (string) $this->element['icon'];
     if (!empty($icon)) {
         $image .= '<img style="margin:0; float:' . $left . ';" src="' . JURI::base(true) . '/../media/' . $name . '/images/' . $icon . '">';
     }
     $helpurl = (string) $this->element['helpurl'];
     if (!empty($helpurl)) {
         $image .= '<a href="' . $helpurl . '" target="_blank"><img style="margin:0; float:' . $right . ';" src="' . JURI::base(true) . '/../media/oziochat/images/question-button-16.png"></a>';
     }
     $style = 'background:#f4f4f4; color:#025a8d; border:1px solid silver; padding:5px; margin:5px 0;';
     if ($this->element['default']) {
         return '<div class="' . $class . '" style="' . $style . '">' . $image . '<span style="padding-' . $left . ':5px; font-weight:bold; line-height:16px;">' . JText::_($this->element['default']) . '</span>' . '</div>';
     } else {
         return parent::getLabel();
     }
     echo '<div class="clr"></div>';
 }
 protected function getLabel()
 {
     $cn = basename(realpath(dirname(__FILE__) . '/../..'));
     $direction = intval(JFactory::getLanguage()->get('rtl', 0));
     $left = $direction ? "right" : "left";
     $right = $direction ? "left" : "right";
     $db = JFactory::getDBO();
     $sql = "SELECT value FROM #__" . substr($cn, 4) . "_settings WHERE name = '" . $this->element['triggerkey'] . "';";
     $db->setQuery($sql);
     $method = $db->loadResult();
     if (!$method) {
         $style = 'clear:both; background:#f4f4f4; border:1px solid silver; padding:5px; margin:5px 0;';
         $image = '<img style="margin:0; float:' . $left . ';" src="' . JUri::base() . '../media/' . $cn . '/images/exclamation-16.png">';
         return '<div style="' . $style . '">' . $image . '<span style="padding-' . $left . ':5px; line-height:16px;">' . 'Problems with database' . '</span>' . '</div>';
     }
     if ($method != $this->element['triggervalue']) {
         return "";
     }
     echo '<div class="clr"></div>';
     $image = '';
     $icon = (string) $this->element['icon'];
     if (!empty($icon)) {
         $image .= '<img style="margin:0; float:' . $left . ';" src="' . JUri::base() . '../media/' . $cn . '/images/' . $icon . '">';
     }
     $style = 'background:#f4f4f4; border:1px solid silver; padding:5px; margin:5px 0;';
     if ($this->element['default']) {
         return '<div style="' . $style . '">' . $image . '<span style="padding-' . $left . ':5px; line-height:16px;">' . 'error' . '</span>' . '</div>';
     } else {
         return parent::getLabel();
     }
     echo '<div class="clr"></div>';
 }
Example #8
0
 function getLabel() {
     if (method_exists($this, 'fetchTooltip')) {
         return $this->fetchTooltip($this->element['label'], $this->description, $this->element, $this->options['control'], $this->element['name'] = '');
     } else {
         return parent::getLabel();
     }
 }
 /**
  * Override by loading Profile Picture parameters.
  *
  * @param   JForm  $form  The form to attach to the form field object.
  *
  * @since   2.0
  */
 public function __construct($form = null)
 {
     $plugin = JPluginHelper::getPlugin('user', 'profilepicture');
     $this->params = new JRegistry($plugin->params);
     $this->maxUploadSizeInBytes = $this->params->get('maxUploadSizeInBytes', 800000);
     parent::__construct($form);
 }
Example #10
0
 protected function getLabel()
 {
     if (JFactory::getApplication()->isAdmin() || JEVHelper::isEventPublisher()) {
         return parent::getLabel();
     }
     return "";
 }
Example #11
0
 protected function getLabel()
 {
     if ($this->getInput()) {
         return parent::getLabel();
     }
     return "";
 }
Example #12
0
 public function __construct()
 {
     parent::__construct();
     //Get configuration
     $app = JFactory::getApplication();
     $config = JFactory::getConfig();
 }
Example #13
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 'input':
             if (empty($this->input)) {
                 $this->input = $this->getInput();
             }
             return $this->input;
             break;
         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);
     }
 }
Example #14
0
 protected function getLabel()
 {
     /*
     		(include_once JPATH_ROOT . "/components/com_foxcontact/helpers/flogger.php") or die(JText::sprintf("JLIB_FILESYSTEM_ERROR_READ_UNABLE_TO_OPEN_FILE", "flogger.php"));
     		$log = new FLogger($this->type, "debug");
     		$log->Write($this->element["name"] . " getLabel()");
     */
     $cn = basename(realpath(dirname(__FILE__) . '/../..'));
     $direction = intval(JFactory::getLanguage()->get('rtl', 0));
     $left = $direction ? "right" : "left";
     $right = $direction ? "left" : "right";
     echo '<div class="clr"></div>';
     $image = '';
     $icon = (string) $this->element['icon'];
     if (!empty($icon)) {
         $image .= '<img style="margin:0; float:' . $left . ';" src="' . JUri::base() . '../media/' . $cn . '/images/' . $icon . '">';
     }
     $helpurl = (string) $this->element['helpurl'];
     if (!empty($helpurl)) {
         $image .= '<a href="' . $helpurl . '" target="_blank"><img style="margin:0; float:' . $right . ';" src="' . JUri::base() . '../media/' . $cn . '/images/question-button-16.png"></a>';
     }
     $style = 'background:#f4f4f4; color:#025a8d; border:1px solid silver; padding:5px; margin:5px 0;';
     if ($this->element['default']) {
         return '<div style="' . $style . '">' . $image . '<span style="padding-' . $left . ':5px; font-weight:bold; line-height:16px;">' . JText::_($this->element['default']) . '</span>' . '</div>';
     } else {
         return parent::getLabel();
     }
     echo '<div class="clr"></div>';
 }
Example #15
0
 function __construct($form = null)
 {
     parent::__construct($form);
     if (!isset($GLOBALS[$this->type . '_initialized'])) {
         $GLOBALS[$this->type . '_initialized'] = true;
         $url_to_assets = JURI::root() . 'libraries/gjfields/';
         $path_to_assets = JPATH_ROOT . '/libraries/gjfields/';
         $doc = JFactory::getDocument();
         $cssname = $url_to_assets . 'css/common.css';
         $cssname_path = $path_to_assets . 'css/common.css';
         if (file_exists($cssname_path)) {
             $doc->addStyleSheet($cssname);
         }
         $this->type = JString::strtolower($this->type);
         $cssname = $url_to_assets . 'css/' . $this->type . '.css';
         $cssname_path = $path_to_assets . 'css/' . $this->type . '.css';
         if (file_exists($cssname_path)) {
             $doc->addStyleSheet($cssname);
         }
         $jversion = new JVersion();
         $common_script = $url_to_assets . 'js/script.js?v=' . $jversion->RELEASE;
         $doc->addScript($common_script);
         $scriptname = $url_to_assets . 'js/' . $this->type . '.js';
         $scriptname_path = $path_to_assets . 'js/' . $this->type . '.js';
         if (file_exists($scriptname_path)) {
             $doc->addScript($scriptname);
         }
     }
 }
Example #16
0
 /**
  * Method to attach a JForm object to the field.
  *  Catch upload files when form setup.
  *
  * @param   SimpleXMLElement $element  The JXmlElement object representing the <field /> tag for the form field object.
  * @param   mixed            $value    The form field value to validate.
  * @param   string           $group    The field name group control value. This acts as as an array container for the field.
  *                                     For example if the field has name="foo" and the group value is set to "bar" then the
  *                                     full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     parent::setup($element, $value, $group);
     $container = \Windwalker\DI\Container::getInstance();
     $input = $container->get('input');
     $delete = isset($_REQUEST['jform']['profile'][$this->element['name'] . '_delete']) ? $_REQUEST['jform']['profile'][$this->element['name'] . '_delete'] : 0;
     if ($delete == 1) {
         $this->value = '';
     } else {
         // Upload Image
         // ===============================================
         if (isset($_FILES['jform']['name']['profile'])) {
             foreach ($_FILES['jform']['name']['profile'] as $key => $var) {
                 if (!$var) {
                     continue;
                 }
                 // Get Field Attr
                 $width = $this->element['save_width'] ? $this->element['save_width'] : 800;
                 $height = $this->element['save_height'] ? $this->element['save_height'] : 800;
                 // Build File name
                 $src = $_FILES['jform']['tmp_name']['profile'][$key];
                 $var = explode('.', $var);
                 $date = DateHelper::getDate();
                 $name = md5((string) $date . $width . $height . $src) . '.' . array_pop($var);
                 $url = "images/cck/{$date->year}/{$date->month}/{$date->day}/" . $name;
                 // A Event for extend.
                 $container->get('event.dispatcher')->trigger('onCCKEngineUploadImage', array(&$url, &$this, &$this->element));
                 $dest = JPATH_ROOT . '/' . $url;
                 // Upload First
                 JFile::upload($src, $dest);
                 // Resize image
                 $img = new JImage();
                 $img->loadFile(JPATH_ROOT . '/' . $url);
                 $img = $img->resize($width, $height);
                 switch (array_pop($var)) {
                     case 'gif':
                         $type = IMAGETYPE_GIF;
                         break;
                     case 'png':
                         $type = IMAGETYPE_PNG;
                         break;
                     default:
                         $type = IMAGETYPE_JPEG;
                         break;
                 }
                 // Save
                 $img->toFile($dest, $type, array('quality' => 85));
                 // Set in Value
                 $this->value = $url;
                 // Clean cache
                 $thumb = $this->getThumbPath();
                 if (is_file(JPATH_ROOT . '/' . $thumb)) {
                     \JFile::delete(JPATH_ROOT . '/' . $thumb);
                 }
             }
         }
     }
     return true;
 }
 public function __construct($form = null)
 {
     parent::__construct($form);
     $this->file = \Triiuark\D::getEnableFile();
     if (is_file($this->file)) {
         $this->isEnabled = true;
     }
 }
Example #18
0
 public function __construct($form = null)
 {
     parent::__construct($form);
     $config = JFactory::getConfig();
     if (!$config->get('caching', 0)) {
         JFactory::getApplication()->enqueueMessage(JText::_('ROKBOOSTER_CACHE_NOT_ENABLED_WARNING'), 'notice');
     }
 }
Example #19
0
 protected function getLabel()
 {
     $offerlock = $this->form->jevdata[$this->name]["offerlock"];
     if ($this->getInput() && $offerlock) {
         return parent::getLabel();
     }
     return "";
 }
Example #20
0
 protected function getLabel()
 {
     $glist = $this->form->jevdata[$this->name]["glist"];
     if ($this->getInput() && $glist) {
         return parent::getLabel();
     }
     return "";
 }
Example #21
0
 protected function getLabel()
 {
     $glist = $this->form->jevdata[$this->name]["glist"];
     if ($this->getInput() && $glist && strpos($glist, "<input ") === false) {
         return parent::getLabel();
     }
     return "";
 }
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->countertype = (string) $this->element['countertype'];
     }
     return $return;
 }
Example #23
0
 protected function getLabel()
 {
     $clistChoice = $this->form->jevdata[$this->name]["clistChoice"];
     if ($this->getInput() && $clistChoice) {
         return parent::getLabel();
     }
     return "";
 }
Example #24
0
 protected function getLabel()
 {
     if ($this->migrator->isInstalled()) {
         return parent::getLabel();
     } else {
         return "";
     }
 }
 protected function getLabel()
 {
     $cfg = JEVConfig::getInstance();
     if ($cfg->get("multicategory", 0)) {
         return parent::getLabel();
     }
     return "";
 }
Example #26
0
 /**
  * Display debug info
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getLabel()
 {
     $apiHelper = new mauticApiHelper();
     $params = $apiHelper->getPluginParams();
     if ($params->get('debug_on')) {
         return parent::getLabel();
     }
 }
Example #27
0
 /**
  * Make sure that the current user has the sufficient privilegies
  *
  * @return string
  */
 protected function getLabel()
 {
     $user = JFactory::getUser();
     if (!$user->authorise('core.multimedia.create', (string) $this->element['component'])) {
         return '';
     }
     return parent::getLabel();
 }
Example #28
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $result = parent::setup($element, $value, $group);
     if ($result == true) {
         $this->contentType = (string) $this->element['content_type'];
     }
     return $result;
 }
Example #29
0
 public function __construct($form = null)
 {
     parent::__construct($form);
     if (!isset($GLOBALS["ozio_textimproved_fields_loaded"])) {
         JFactory::getDocument()->addStyleSheet(JUri::base(true) . "/components/com_oziogallery3/models/fields/fields.css");
         JFactory::getDocument()->addScript(JUri::base(true) . "/components/com_oziogallery3/js/get_id.js");
         $GLOBALS["ozio_textimproved_fields_loaded"] = true;
     }
 }
Example #30
0
 /**
  *
  * Get Label of element param
  * @return string label
  */
 function getLabel()
 {
     $func = (string) $this->element['function'] ? (string) $this->element['function'] : '';
     if (substr($func, 0, 1) == '@' || !isset($this->label) || !$this->label) {
         return;
     } else {
         return parent::getLabel();
     }
 }