예제 #1
0
 function getInput()
 {
     $name = $this->attributes['name'];
     $label = $this->attributes['label'];
     $type = $this->attributes['type'];
     $disabled = $this->attributes['disabled'] ? ' disabled="disabled"' : '';
     $hidden = $this->attributes['hidden'] ? ' style="display: none;"' : '';
     $value = $this->value;
     $field = plgSystemMinicck::getCustomField($name);
     $options = array();
     if (is_array($field["params"]) && count($field["params"]) > 0) {
         foreach ($field["params"] as $key => $val) {
             $options[] = JHtml::_('select.option', $key, JText::_($val));
         }
     }
     $fieldname = $this->name;
     $id = str_replace(array('][', ']', '['), array('_', '', '_'), $fieldname);
     $html = '<div class="control-group ' . $name . '"' . $hidden . '>';
     $html .= '<label for="' . $id . '" class="control-label" title="" >' . $label . '</label>';
     $html .= '<div class="controls">';
     $html .= JHTML::_('select.genericlist', $options, $fieldname, 'id="' . $id . '"' . $disabled . ' class="type inputbox ' . $name . '"', 'value', 'text', $value);
     $html .= '</div>';
     $html .= '</div>';
     return $html;
 }
예제 #2
0
 function getInput()
 {
     $name = $this->attributes['name'];
     $label = $this->attributes['label'];
     $type = $this->attributes['type'];
     $disabled = $this->attributes['disabled'] ? ' disabled="disabled"' : '';
     $hidden = $this->attributes['hidden'] ? ' style="display: none;"' : '';
     $value = explode(',', $this->value);
     $field = plgSystemMinicck::getCustomField($name);
     $fieldname = $this->name;
     $id = str_replace(array('][', ']', '['), array('_', '', '_'), $fieldname);
     $html = '<div class="control-group ' . $name . '"' . $hidden . '>';
     $html .= '<label for="' . $id . '" class="control-label" title="" >' . $label . '</label>';
     $html .= '<div class="controls" id="' . $id . '">';
     if (is_array($field["params"]) && count($field["params"]) > 0) {
         foreach ($field["params"] as $key => $val) {
             $id = str_replace(array('][', ']', '['), '_', $fieldname) . $key;
             $checked = is_array($value) && in_array($key, $value) ? 'checked="checked"' : '';
             $html .= '
             <label for="' . $id . '" id="' . $id . '-lbl" class="checkbox">' . $val . '
             <input style="float: left;" type="checkbox" name="' . $fieldname . '[]" id="' . $id . '" value="' . $key . '" ' . $checked . ' class="checkbox ' . $name . '"' . $disabled . '/>
             </label>';
             //$options[] = JHtml::_('select.option', $key,     JText::_($val));
         }
     }
     $html .= '</div>';
     $html .= '</div>';
     return $html;
 }
예제 #3
0
 function getInput()
 {
     if (!defined('PLG_MINICCK_MCIMAGE_LOADED')) {
         define('PLG_MINICCK_MCIMAGE_LOADED', 1);
         JHtml::_('behavior.modal');
         // Build the script.
         $script = array();
         $script[] = '	function jInsertFieldValue(value, id) {';
         $script[] = '		var old_value = document.id(id).value;';
         $script[] = '		if (old_value != value) {';
         $script[] = '			var elem = document.id(id);';
         $script[] = '			elem.value = value;';
         $script[] = '			elem.fireEvent("change");';
         $script[] = '			if (typeof(elem.onchange) === "function") {';
         $script[] = '				elem.onchange();';
         $script[] = '			}';
         $script[] = '			jMediaRefreshPreview(id);';
         $script[] = '		}';
         $script[] = '	}';
         JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
     }
     $name = $this->attributes['name'];
     $label = $this->attributes['label'];
     $type = $this->attributes['type'];
     $disabled = $this->attributes['disabled'] ? ' disabled="disabled"' : '';
     $hidden = $this->attributes['hidden'] ? ' style="display: none;"' : '';
     $value = $this->value;
     $field = plgSystemMinicck::getCustomField($name);
     $directory = trim($field["params"]);
     $directory = !empty($directory) ? $directory : '/images';
     if (substr($directory, 0, 1) !== '/') {
         $directory = '/' . $directory;
     }
     if (!is_dir(JPATH_ROOT . $directory)) {
         $directory = '/images/';
     }
     if (substr($directory, -1) !== '/') {
         $directory = $directory . '/';
     }
     $fieldname = $this->name;
     $id = str_replace(array('][', ']', '['), array('_', '', '_'), $fieldname);
     $html = '<div class="control-group ' . $name . '"' . $hidden . '>';
     $html .= '<label for="' . $id . '" class="control-label" title="" >' . $label . '</label>';
     $html .= '<div class="controls">';
     $html .= '<input type="text" id="' . $id . '" name="' . $fieldname . '" value="' . $value . '" class="input-small ' . $name . '"' . $disabled . '>';
     $html .= '<a class="modal btn" title="' . JText::_('JLIB_FORM_BUTTON_SELECT') . '" href="' . 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;asset=com_content&amp;author=&amp;fieldid=' . $id . '&amp;folder=' . $directory . '"' . ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}">';
     $html .= JText::_('JLIB_FORM_BUTTON_SELECT') . '</a><a class="btn hasTooltip" title="' . JText::_('JLIB_FORM_BUTTON_CLEAR') . '" href="#" onclick="';
     $html .= 'jInsertFieldValue(\'\', \'' . $id . '\');';
     $html .= 'return false;';
     $html .= '">';
     $html .= '<i class="icon-remove"></i></a>';
     $html .= '</div>';
     $html .= '</div>';
     return $html;
 }
예제 #4
0
 function getInput()
 {
     $name = $this->attributes['name'];
     $label = $this->attributes['label'];
     $type = $this->attributes['type'];
     $disabled = $this->attributes['disabled'] ? ' disabled="disabled"' : '';
     $hidden = $this->attributes['hidden'] ? ' style="display: none;"' : '';
     $value = $this->value;
     $field = plgSystemMinicck::getCustomField($name);
     $fieldname = $this->name;
     $id = str_replace(array('][', ']', '['), array('_', '', '_'), $fieldname);
     $html = '<div class="control-group ' . $name . '"' . $hidden . '>';
     $html .= '<label for="' . $id . '" class="control-label" title="" >' . $label . '</label>';
     $html .= '<div class="controls">';
     $html .= '<input type="text" id="' . $id . '" name="' . $fieldname . '" value="' . $value . '" class="inputbox ' . $name . '"' . $disabled . '>';
     $html .= '</div>';
     $html .= '</div>';
     return $html;
 }
예제 #5
0
 function getInput()
 {
     if (!defined('PLG_MINICCK_MINIGALLERY_LOADED')) {
         define('PLG_MINICCK_MINIGALLERY_LOADED', 1);
         JHtml::_('behavior.modal');
         JHtml::_('behavior.framework');
         JFactory::getDocument()->addScript(JUri::root() . 'plugins/system/minicck/fields/minigallery/assets/js/script.js');
     }
     self::loadLang('minigallery');
     $name = $this->attributes['name'];
     $label = $this->attributes['label'];
     $type = $this->attributes['type'];
     $disabled = $this->attributes['disabled'] ? ' disabled="disabled"' : '';
     $hidden = $this->attributes['hidden'] ? ' style="display: none;"' : '';
     $value = json_decode($this->value, true);
     $field = plgSystemMinicck::getCustomField($name);
     $directory = trim($field["params"]);
     $directory = !empty($directory) ? $directory : '/images';
     if (substr($directory, 0, 1) !== '/') {
         $directory = '/' . $directory;
     }
     if (!is_dir(JPATH_ROOT . $directory)) {
         $directory = '/images/';
     }
     if (substr($directory, -1) !== '/') {
         $directory = $directory . '/';
     }
     $fieldname = $this->name;
     $id = str_replace(array('][', ']', '['), array('_', '', '_'), $fieldname);
     $html = '
         <div class="control-group ' . $name . '"' . $hidden . '>
             <label for="' . $id . '_image" class="control-label" title="" >' . $label . '</label>
             <div class="controls">
             <a class="btn btn-small btn-success del_button"
                 style="margin-bottom: 5px"
                 href="#"
                 onclick="minigalleryADDField(this, \'' . $id . '\', \'' . $fieldname . '\', \'' . $name . '\', \'' . $directory . '\');
                 return false;">
                 ' . JText::_('PLG_MINICCK_MINIGALLERY_ADD_FIELD') . '
             </a>
         ';
     if (count($value) > 0) {
         foreach ($value as $k => $v) {
             $html .= '
             <div class="minicck_minigallery" style="margin-bottom: 5px">
                 <input type="text" placeholder="image" id="' . $id . '_' . $k . '_image" name="' . $fieldname . '[' . $k . '][image]" value="' . $v['image'] . '" class="input-big ' . $name . '"' . $disabled . '/>
                 <a class="modal btn" title="' . JText::_('JLIB_FORM_BUTTON_SELECT') . '" href="' . 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;asset=com_content&amp;author=&amp;fieldid=' . $id . '_' . $k . '_image&amp;folder=' . $directory . '"' . ' rel="{handler: \'iframe\', size: {x: 800, y: 600}}">' . JText::_('JLIB_FORM_BUTTON_SELECT') . '
                 </a>
                 <a class="btn hasTooltip" title="Delete"
                     href="#" onclick="minigalleryDeleteField(this); return false;">
                     <i class="icon-remove"></i>
                 </a>
                 <input type="text" placeholder="alt" id="' . $id . '_' . $k . '_alt" name="' . $fieldname . '[' . $k . '][alt]" value="' . $v['alt'] . '" class="input-big ' . $name . '"' . $disabled . '/>
             </div>
             ';
         }
     }
     $html .= '
             </div>
         </div>';
     return $html;
 }
예제 #6
0
 private function setCustomFields()
 {
     $customfields = $this->config['params'];
     $customfields = $customfields->customfields;
     if (!is_array($customfields) || count($customfields) == 0) {
         return;
     }
     $newFields = array();
     foreach ($customfields as $customfield) {
         $k = $customfield->name;
         $newFields[$k]['name'] = $customfield->name;
         $newFields[$k]['title'] = $customfield->title;
         $newFields[$k]['type'] = $customfield->type;
         $newFields[$k]['extraparams'] = !empty($customfield->extraparams) ? $customfield->extraparams : null;
         $className = $this->loadElement($newFields[$k]);
         if ($className != false && method_exists($className, 'prepareParams')) {
             $newFields[$k]['params'] = $className::prepareParams($customfield->params);
         } else {
             $newFields[$k]['params'] = $customfield->params;
         }
     }
     self::$customfields = $newFields;
 }