Beispiel #1
0
 function render()
 {
     // TODO: controllo acl
     $name = $this->getId();
     $attributes = array();
     $attributes['id'] = $this->getId();
     $attributes['name'] = $this->getOriginalId();
     $attributes['disabled'] = $this->getAttribute('disabled') ? 'disabled' : '';
     $attributes['data-type'] = $this->getAttribute('data-type') ? $this->getAttribute('data-type') : 'selectpagetype';
     $attributes['class'] = $this->getAttribute('required') ? 'required' : '';
     $attributes['class'] .= $this->getAttribute('cssClass') != '' ? ($attributes['class'] != '' ? ' ' : '') . $this->getAttribute('cssClass') : '';
     $attributes['class'] .= ' hidden';
     $attributes['value'] = $this->_content;
     $output = '<input ' . $this->_renderAttributes($attributes) . '/>';
     $output .= '<ul class="' . $this->getAttribute('cssClass') . '">';
     foreach ($this->templates as $template) {
         $output .= '<li>';
         $output .= '<a class="" data-type="' . $template->path . '"><img src="' . $template->preview . '" />' . $template->name . '</a>';
         $output .= '</li>';
     }
     $output .= '</ul>';
     $cssClassLabel = $this->getAttribute('cssClassLabel');
     $cssClassLabel .= ($cssClassLabel ? ' ' : '') . ($this->getAttribute('required') ? 'required' : '');
     $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), false, '', array('class' => $cssClassLabel), false);
     $this->addOutputCode($this->applyItemTemplate($label, $output));
 }
Beispiel #2
0
 protected function applyItemTemplate($label, $element)
 {
     if ($this->_outputMode != 'jsediting' && is_null($this->getAttribute('skin')) && $editableRegion != 'head' && $this->getAttribute('applyFormItemTemplate')) {
         return org_glizy_helpers_Html::applyItemTemplate($label, $element, $this->_hiddenItem, $this->_rightLabel);
     } else {
         return $label . $element;
     }
 }
Beispiel #3
0
 public static function translateForMode_edit($node)
 {
     $attributes = array();
     $attributes['id'] = $node->getAttribute('id');
     $attributes['label'] = $node->getAttribute('label');
     $attributes['cssClass'] = $node->getAttribute('cssClass');
     return org_glizy_helpers_Html::renderTag('glz:Panel', $attributes);
 }
Beispiel #4
0
 public static function translateForMode_edit($node)
 {
     $attributes = array();
     $attributes['id'] = $node->getAttribute('id');
     $attributes['label'] = $node->getAttribute('label');
     $attributes['required'] = $node->getAttribute('required');
     $attributes['xmlns:cms'] = "org.glizycms.views.components.*";
     return org_glizy_helpers_Html::renderTag('cms:SelectPage', $attributes);
 }
Beispiel #5
0
 public static function translateForMode_edit($node)
 {
     $attributes = array();
     $attributes['id'] = $node->getAttribute('id');
     $attributes['label'] = $node->getAttribute('label');
     $attributes['data'] = '';
     $attributes['noChild'] = 'true';
     return org_glizy_helpers_Html::renderTag('glz:Checkbox', $attributes);
 }
Beispiel #6
0
 function render_html()
 {
     $name = $this->getAttribute('name');
     if ($this->_content === true) {
         $this->_content = 'true';
     }
     if ($this->_content === false) {
         $this->_content = 'false';
     }
     $output = org_glizy_helpers_Html::hidden(empty($name) ? $this->getOriginalId() : $name, !is_object($this->_content) && !is_array($this->_content) ? $this->_content : json_encode($this->_content), array('class' => $this->getAttribute('cssClass')), $this->getAttribute('data'));
     $this->addOutputCode($this->applyItemTemplate('', $output, true));
 }
Beispiel #7
0
 public static function translateForMode_edit($node)
 {
     $min = $node->hasAttribute('adm:min') ? $node->getAttribute('adm:min') : '0';
     $max = $node->hasAttribute('adm:max') ? $node->getAttribute('adm:max') : '100';
     $collapsable = $node->hasAttribute('adm:collapsable') && $node->getAttribute('adm:collapsable') == 'true' ? 'true' : 'false';
     $attributes = array();
     $attributes['id'] = $node->getAttribute('id');
     $attributes['label'] = $node->getAttribute('label');
     $attributes['data'] = 'type=repeat;repeatMin=' . $min . ';repeatMax=' . $max . ';collapsable=' . $collapsable;
     if ($node->hasAttribute('adm:data')) {
         $attributes['data'] .= ';' . $node->getAttribute('adm:data');
     }
     return org_glizy_helpers_Html::renderTag('glz:Fieldset', $attributes);
 }
Beispiel #8
0
 function render_html()
 {
     $output = '';
     $attributes = $this->getContent(true);
     $output = '<input ' . $this->_renderAttributes($attributes) . '/>';
     $cssClassLabel = $this->getAttribute('cssClassLabel');
     $cssClassLabel .= ($cssClassLabel ? ' ' : '') . ($this->getAttribute('required') ? 'required' : '');
     if ($this->getAttribute('wrapLabel')) {
         $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), true, $output, array('class' => $cssClassLabel), false);
         $output = '';
     } else {
         $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), false, '', array('class' => $cssClassLabel), false);
     }
     $this->addOutputCode($this->applyItemTemplate($label, $output));
 }
Beispiel #9
0
 public static function getResizedImageById($id, $direct = false, $width, $height, $crop = false, $cssClass = '', $style = '', $onclick = '')
 {
     $media =& org_glizycms_mediaArchive_MediaManager::getMediaById($id);
     if (is_null($media)) {
         return '';
     }
     if ($direct) {
         $thumb = $media->getThumbnail($width, $height, $crop);
     }
     $attributes = array();
     $attributes['alt'] = $media->title;
     $attributes['title'] = $media->title;
     $attributes['class'] = $cssClass;
     $attributes['style'] = $style;
     $attributes['onclick'] = $onclick;
     $attributes['src'] = $direct ? $thumb['fileName'] : org_glizycms_Glizycms::getMediaArchiveBridge()->getImageByIdAndResize($id, $width, $height, $crop);
     return org_glizy_helpers_Html::renderTag('img', $attributes);
 }
Beispiel #10
0
 function run(&$parent, $params)
 {
     $application = org_glizy_ObjectValues::get('org.glizy', 'application');
     $languageId = $application->getLanguageId();
     $language = $application->getLanguage();
     $it = org_glizy_objectFactory::createModelIterator('movio.search.models.Content');
     $it->load('getVisibleEntities', array(':words' => $params, ':language' => $languageId));
     foreach ($it as $ar) {
         //$ar->dump();
         $result = $parent->getResultStructure();
         $result['title'] = $ar->title;
         $result['description'] = $ar->description;
         if ($ar->keyInDataExists('url') && $ar->url) {
             $url = org_glizy_helpers_Html::renderTag('a', array('href' => $language . '/' . $ar->url), true, $ar->title);
         } else {
             $url = __Link::makeLink('link', array('pageId' => $ar->pageId, 'title' => $ar->title));
         }
         $result['__url__'] = $url;
         $parent->addResult($result);
     }
 }
Beispiel #11
0
 function render()
 {
     // TODO: controllo acl
     $name = $this->getId();
     if (!$this->_user->acl($this->_application->getPageId(), 'new') || $this->getAttribute('hide')) {
         $output = org_glizy_helpers_Html::hidden($name, $this->_content, array('class' => $this->getAttribute('cssClass')));
         $this->addOutputCode($output);
     } else {
         $attributes = array();
         $attributes['id'] = $this->getId();
         $attributes['name'] = $this->getOriginalId();
         $attributes['disabled'] = $this->getAttribute('disabled') ? 'disabled' : '';
         $attributes['data-type'] = $this->getAttribute('data-type') ? $this->getAttribute('data-type') : 'selectpagetype';
         $attributes['data-linked'] = $this->getAttribute('linked') ? $this->getAttribute('linked') : '';
         $attributes['data-onlywithparent'] = $this->getAttribute('onlyWithParent') ? $this->getAttribute('onlyWithParent') : '';
         $attributes['class'] = $this->getAttribute('required') ? 'required' : '';
         $attributes['class'] .= $this->getAttribute('cssClass') != '' ? ($attributes['class'] != '' ? ' ' : '') . $this->getAttribute('cssClass') : '';
         $attributes['class'] .= ' hidden';
         $output = '<input ' . $this->_renderAttributes($attributes) . '/>';
         $output .= '<ul class="pageTypeSelect">';
         foreach ($this->items as $v) {
             $output .= '<li>';
             $output .= '<a class="' . $v['cssClass'] . '" data-type="' . $v['type'] . '" data-acceptparent="' . @$v['acceptParent'] . '">' . $v['label'] . '</a>';
             $output .= '</li>';
         }
         $output .= '</ul>';
         $cssClassLabel = $this->getAttribute('cssClassLabel');
         $cssClassLabel .= ($cssClassLabel ? ' ' : '') . ($this->getAttribute('required') ? 'required' : '');
         if ($this->getAttribute('wrapLabel')) {
             $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), true, $output, array('class' => $cssClassLabel), false);
             $output = '';
         } else {
             $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), false, '', array('class' => $cssClassLabel), false);
         }
         $this->addOutputCode($this->applyItemTemplate($label, $output));
     }
 }
Beispiel #12
0
 function run(&$parent, $params)
 {
     $application = org_glizy_ObjectValues::get('org.glizy', 'application');
     $languageId = $application->getLanguageId();
     $language = $application->getLanguage();
     $it = org_glizy_objectFactory::createModelIterator('movio.search.models.Entity');
     $it->load('getVisibleEntities', array(':words' => $params, ':language' => $languageId));
     foreach ($it as $ar) {
         //$ar->dump();
         $application = org_glizy_ObjectValues::get('org.glizy', 'application');
         $entityTypeService = $application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService');
         $descriptionAttribute = $entityTypeService->getDescriptionAttribute($ar->entityTypeId);
         $result = $parent->getResultStructure();
         $result['title'] = $ar->title;
         $result['description'] = $descriptionAttribute && $ar->keyInDataExists($descriptionAttribute) ? $ar->{$descriptionAttribute} : '';
         if ($ar->keyInDataExists('url') && $ar->url) {
             $url = org_glizy_helpers_Html::renderTag('a', array('href' => $language . '/' . $ar->url), true, $ar->title);
         } else {
             $url = __Link::makeLink('showEntityDetail', $ar->getValuesAsArray());
         }
         $result['__url__'] = $url;
         $parent->addResult($result);
     }
 }
Beispiel #13
0
 function render()
 {
     $dbServiceFactory = org_glizy_ObjectFactory::createObject('movio.modules.modulesBuilder.services.DbServiceFactory');
     $dbService = $dbServiceFactory->createDbService(__Config::get('DB_TYPE'));
     $dbService->connect(__Config::get('DB_HOST'), __Config::get('DB_PORT'), __Config::get('DB_USER'), __Config::get('DB_PSW'), __Config::get('DB_NAME'));
     $tables = $dbService->getTableNames();
     $attributes = array();
     $attributes['id'] = $this->getId();
     $attributes['name'] = $this->getOriginalId();
     $attributes['class'] = $this->getAttribute('required') ? 'required' : '';
     $attributes['class'] .= $this->getAttribute('cssClass') != '' ? ($attributes['class'] != '' ? ' ' : '') . $this->getAttribute('cssClass') : '';
     $attributes['title'] = $this->getAttributeString('title');
     $attributes['onchange'] = $this->getAttribute('onChange');
     if ($this->getAttribute('rows') > 1) {
         $attributes['size'] = $this->getAttribute('rows');
     }
     $output = '<select ' . $this->_renderAttributes($attributes) . '>';
     foreach ($tables as $item) {
         $output .= '<option value="' . glz_encodeOutput($item) . '">' . glz_encodeOutput($item) . '</option>';
     }
     $output .= '</select>';
     $output = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), $this->getAttribute('wrapLabel'), $output, array('class' => $this->getAttribute('required') ? 'required' : ''), false);
     $this->addOutputCode($output);
 }
Beispiel #14
0
 function render()
 {
     // TODO: controllo acl
     $name = $this->getId();
     if (!$this->_user->acl($this->_application->getPageId(), 'new')) {
         $output = org_glizy_helpers_Html::hidden($name, $this->_content, array('class' => $this->getAttribute('cssClass')));
     } else {
         $pageTypes = array();
         if ($dh = @opendir(org_glizy_Paths::get('APPLICATION_TO_ADMIN_PAGETYPE'))) {
             // scan the pageType folder
             while ($fileName = readdir($dh)) {
                 // check if the item is a folder
                 if ($fileName != "." && $fileName != ".." && strpos($fileName, '.xml') !== false) {
                     if ($fileName == 'Common.xml') {
                         continue;
                     }
                     $pageTypes[] = preg_replace('/\\.xml/i', '', $fileName);
                 }
             }
             closedir($dh);
             glz_loadLocale(org_glizy_Paths::get('APPLICATION_TO_ADMIN_PAGETYPE'));
         } else {
             // can't open pageTypes folder
             // show the error
             new org_glizy_Exception(array('[%s] %s: %s', $this->getClassName(), GLZ_ERR_NO_PAGETYPE_FOLDER, org_glizy_Paths::get('APPLICATION_TO_ADMIN') . '/pageTypes/'));
         }
         $modules = org_glizy_Modules::getModules();
         foreach ($modules as $moduleVO) {
             if ($moduleVO->pageType) {
                 $pageTypes[] = $moduleVO->pageType;
             }
         }
         $output = '<option value=""></option>';
         $values = array(array($this->getAttribute('emptyValue'), '', 1, array(), 0));
         $modifyMode = $this->getAttribute('modify');
         foreach ($pageTypes as $item) {
             $moduleVO = null;
             foreach ($modules as $m) {
                 if ($m->pageType == $item) {
                     $moduleVO = $m;
                     break;
                 }
             }
             if ($moduleVO) {
                 if (!$moduleVO->show) {
                     continue;
                 }
                 if ($moduleVO->unique && (!$modifyMode || $modifyMode && $item != $this->_content)) {
                     $ar =& org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Menu');
                     $result = $ar->find(array('menu_pageType' => $item));
                     unset($ar);
                     if ($result) {
                         continue;
                     }
                 }
             }
             $pageName = __T($item);
             $output .= '<option value="' . $item . '"' . ($item == $this->_content ? ' selected' : '') . '>' . __T($item) . '</option>';
         }
         $attributes = array();
         $attributes['id'] = $this->getId();
         $attributes['name'] = $this->getOriginalId();
         $attributes['disabled'] = $this->getAttribute('disabled') ? 'disabled' : '';
         $attributes['class'] = $this->getAttribute('required') ? 'required' : '';
         $attributes['class'] .= $this->getAttribute('cssClass') != '' ? ($attributes['class'] != '' ? ' ' : '') . $this->getAttribute('cssClass') : '';
         $output = '<select ' . $this->_renderAttributes($attributes) . '>' . $output . '</select>';
         $cssClassLabel = $this->getAttribute('cssClassLabel');
         $cssClassLabel .= ($cssClassLabel ? ' ' : '') . ($this->getAttribute('required') ? 'required' : '');
         if ($this->getAttribute('wrapLabel')) {
             $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), true, $output, array('class' => $cssClassLabel), false);
             $output = '';
         } else {
             $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), false, '', array('class' => $cssClassLabel), false);
         }
         $this->addOutputCode($this->applyItemTemplate($label, $output));
     }
 }
Beispiel #15
0
 public static function translateForMode_edit($node)
 {
     $attributes = array();
     $attributes['id'] = $node->getAttribute('id');
     $attributes['label'] = $node->getAttribute('label');
     $attributes['data'] = 'type=imageHotspot';
     return org_glizy_helpers_Html::renderTag('glz:Input', $attributes);
 }
Beispiel #16
0
 function _render_html(&$menu, &$output)
 {
     $attributes = array();
     $attributes['class'] = $this->getAttribute('cssClass');
     if (empty($output)) {
         if (!$this->getAttribute('omitId')) {
             $attributes['id'] = $this->getId();
         }
         $attributes['title'] = $this->getAttributeString('title');
         $output .= org_glizy_helpers_Html::renderTag('ul', $attributes, false);
     } else {
         $attributes['class'] = $this->getAttribute('nestedCssClass') ? $attributes['class'] : '';
         $output .= org_glizy_helpers_Html::renderTag('ul', $attributes, false);
     }
     for ($i = 0; $i < count($menu); $i++) {
         if (is_array($menu[$i]['node'])) {
             $this->_render_html($menu[$i]['node'], $output);
             $output .= '</li>';
         } else {
             $cssClass = $menu[$i]['cssClass'];
             $selected = $menu[$i]['selected'];
             if ($cssClass) {
                 if (strpos($selected, 'class="') !== false) {
                     $selected = str_replace('class="', 'class="' . $cssClass . ' ', $selected);
                     $cssClass = '';
                 } else {
                     $cssClass = 'class="' . $cssClass . '"';
                 }
             }
             $attributes = trim($cssClass . ' ' . $selected);
             $output .= '<li' . ($attributes ? ' ' . $attributes : '') . '>' . $menu[$i]['node'] . ($i + 1 < count($menu) && is_array($menu[$i + 1]['node']) ? '' : '</li>');
         }
     }
     $output .= '</ul>';
 }
Beispiel #17
0
 function _render_html()
 {
     if (!empty($this->mediaUrl)) {
         $attributes = $this->_content;
         if (is_string($this->mediaUrl) && (!is_null($this->getAttribute('width')) || !is_null($this->getAttribute('height')))) {
             if (strpos($this->mediaUrl, 'http://') === 0) {
                 $extension = pathinfo(parse_url($this->mediaUrl, PHP_URL_PATH), PATHINFO_EXTENSION);
                 $cacheFileName = 'external_' . md5($this->mediaUrl) . '.' . $extension;
                 $cacheFilePath = __Paths::get('CACHE') . $cacheFileName;
                 // scarica il file e lo mette in cache
                 if (!file_exists($cacheFilePath)) {
                     @file_put_contents($cacheFilePath, @file_get_contents($this->mediaUrl));
                 }
                 $params = array('media_id' => 0, 'media_fileName' => $cacheFilePath);
                 $this->media = __ObjectFactory::createObject('org.glizycms.mediaArchive.media.Image', $params);
             }
             $this->media->allowDownload = true;
             $thumbnail = $this->media->getResizeImage($this->getAttribute('width'), $this->getAttribute('height'), $this->getAttribute('crop'), $this->getAttribute('cropOffset'), false, false);
             $attributes['src'] = $thumbnail['fileName'];
             $attributes['width'] = $thumbnail['width'];
             $attributes['height'] = $thumbnail['height'];
             $this->_content['src'] = $thumbnail['fileName'];
             $this->_content['width'] = $thumbnail['width'];
             $this->_content['height'] = $thumbnail['height'];
         }
         unset($attributes['mediaUrl']);
         unset($attributes['zoom']);
         unset($attributes['size']);
         unset($attributes['mediaType']);
         $this->_content['__html__'] = '<img ' . $this->_renderAttributes($attributes) . '/>';
         if ($this->getAttribute('zoom') || $useZoom) {
             $this->_application->addLightboxJsCode();
             $attributes = array();
             $attributes['title'] = $this->_content['title'];
             $thumbnail = $this->media->getResizeImage(__Config::get('IMG_WIDTH_ZOOM'), __Config::get('IMG_HEIGHT_ZOOM'));
             $attributes['href'] = $thumbnail['fileName'];
             $attributes['rel'] = 'milkbox' . ($this->getAttribute('group') != '' ? '[' . $this->getAttribute('group') . ']' : '');
             $attributes['class'] = $zoomCssClass;
             $this->_content['__html__'] = org_glizy_helpers_Html::renderTag('a', $attributes, true, $this->_content['__html__']);
         }
     } else {
         $this->_content['__html__'] = '';
     }
 }
Beispiel #18
0
 public static function translateForMode_edit($node)
 {
     $attributes = array();
     $attributes['id'] = $node->getAttribute('id');
     $attributes['label'] = $node->getAttribute('label');
     $attributes['data'] = '';
     if (count($node->attributes)) {
         foreach ($node->attributes as $index => $attr) {
             if ($attr->prefix == "adm") {
                 $attributes[$attr->name] = $attr->value;
             }
         }
     }
     if (!isset($attributes['cssClass'])) {
         $attributes['cssClass'] = '{config:glizy.formElement.admCssClass}';
     }
     return org_glizy_helpers_Html::renderTag('glz:Input', $attributes);
 }
Beispiel #19
0
 public static function translateForMode_edit($node)
 {
     if ($node->hasAttribute('adm:showControl') && $node->getAttribute('adm:showControl') == 'true') {
         $attributes = array();
         $attributes['id'] = $node->getAttribute('id');
         $attributes['label'] = $node->getAttribute('label');
         $attributes['size'] = 10;
         return org_glizy_helpers_Html::renderTag('glz:Input', $attributes);
     }
 }
Beispiel #20
0
 /**
  * @param array $attributes
  *
  * @return string
  */
 function _renderAttributes($attributes = array())
 {
     return org_glizy_helpers_Html::renderAttributes($attributes, $this->getAttribute('data'));
 }
Beispiel #21
0
 public static function translateForMode_edit($node)
 {
     $mediaType = $node->getAttribute('adm:mediaType');
     $attributes = array();
     $attributes['id'] = $node->getAttribute('id');
     $attributes['label'] = $node->getAttribute('label');
     $attributes['data'] = $node->getAttribute('data') . ';type=mediapicker;mediatype=' . $mediaType . ';preview=true';
     if (count($node->attributes)) {
         foreach ($node->attributes as $index => $attr) {
             if ($attr->prefix == "adm") {
                 $attributes[$attr->name] = $attr->value;
             }
         }
     }
     return org_glizy_helpers_Html::renderTag('glz:Input', $attributes);
 }
Beispiel #22
0
 public static function translateForMode_edit($node)
 {
     $attributes = array();
     $attributes['id'] = $node->getAttribute('id');
     $attributes['label'] = $node->getAttribute('label');
     if (count($node->attributes)) {
         foreach ($node->attributes as $index => $attr) {
             if ($attr->prefix == "adm") {
                 $attributes[$attr->name] = $attr->value;
             }
         }
     }
     return org_glizy_helpers_Html::renderTag('glz:Input', $attributes);
 }
Beispiel #23
0
 public static function translateForMode_edit($node)
 {
     $attributes = array();
     $attributes['id'] = $node->getAttribute('id');
     $attributes['label'] = $node->getAttribute('label');
     $attributes['noChild'] = 'true';
     $attributes['data'] = '';
     if ($node->hasAttribute('adm:data')) {
         $attributes['data'] .= ';' . $node->getAttribute('adm:data');
     }
     return org_glizy_helpers_Html::renderTag('glz:Input', $attributes);
 }
Beispiel #24
0
 function _render()
 {
     if ($this->getAttribute('outputOnlyValue')) {
         return $this->_content;
     } else {
         $output = '';
         $attributes = array();
         $attributes['id'] = $this->getId();
         $attributes['name'] = $this->getOriginalId();
         $attributes['disabled'] = $this->getAttribute('disabled') ? 'disabled' : '';
         $attributes['class'] = $this->getAttribute('required') ? 'required' : '';
         $attributes['class'] .= $this->getAttribute('cssClass') != '' ? ($attributes['class'] != '' ? ' ' : '') . $this->getAttribute('cssClass') : '';
         $attributes['title'] = $this->getAttributeString('title');
         $attributes['onchange'] = $this->getAttribute('onChange');
         if ($this->getAttribute('readOnly')) {
             $output .= org_glizy_helpers_Html::hidden($attributes['name'], $this->_content);
             $attributes['name'] .= '_orig';
             $attributes['id'] .= '_orig';
             $attributes['disabled'] = true;
         }
         if ($this->getAttribute('rows') > 1) {
             $attributes['size'] = $this->getAttribute('rows');
             $attributes['multiple'] = $this->getAttribute('multiSelect') ? 'multiple' : '';
         }
         $output .= '<select ' . $this->_renderAttributes($attributes) . '>';
         foreach ($this->_items as $item) {
             if ($this->_content == '' || is_null($this->_content)) {
                 $selected = isset($item['selected']) && $item['selected'] ? ' selected="selected"' : '';
             } else {
                 if (is_array($this->_content)) {
                     $selected = in_array(strtoupper($item['key']), $this->_content) ? ' selected="selected"' : '';
                 } else {
                     $selected = strtoupper($item['key']) == strtoupper($this->_content) ? ' selected="selected"' : '';
                 }
             }
             $disabled = isset($item['disabled']) ? ' ' . $item['disabled'] : '';
             $options = isset($item['options']) ? ' data-options="' . $item['options'] . '"' : '';
             $output .= '<option value="' . glz_encodeOutput($item['key']) . '"' . $selected . $disabled . $options . '>' . glz_encodeOutput($item['value']) . '</option>';
         }
         $output .= '</select>';
         $label = $this->getAttributeString('label') ?: '';
         if ($label) {
             $cssClassLabel = $this->getAttribute('cssClassLabel');
             $cssClassLabel .= ($cssClassLabel ? ' ' : '') . ($this->getAttribute('required') ? 'required' : '');
             if ($this->getAttribute('wrapLabel')) {
                 $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), true, $output, array('class' => $cssClassLabel), false);
                 $output = '';
             } else {
                 $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), false, '', array('class' => $cssClassLabel), false);
             }
         }
         return $this->applyItemTemplate($label, $output);
     }
 }
Beispiel #25
0
 /**
  * Render
  *
  * @return	void
  * @access	public
  */
 function render_html()
 {
     $attributes = array();
     $attributes['id'] = $this->getId();
     $attributes['name'] = $this->getOriginalId();
     $attributes['disabled'] = $this->getAttribute('disabled') ? 'disabled' : '';
     $attributes['readonly'] = $this->getAttribute('readOnly') ? 'readonly' : '';
     $attributes['title'] = $this->getAttributeString('title');
     $attributes['placeholder'] = $this->getAttributeString('placeholder');
     if (empty($attributes['title'])) {
         $attributes['title'] = $this->getAttributeString('label');
     }
     $attributes['class'] = $this->getAttribute('cssClass');
     $attributes['class'] .= (!empty($attributes['class']) ? ' ' : '') . ($this->getAttribute('required') ? 'required' : '');
     if ($this->getAttribute('type') == 'multiline') {
         $attributes['cols'] = $this->getAttribute('cols');
         $attributes['rows'] = $this->getAttribute('rows');
         $attributes['wrap'] = $this->getAttribute('wrap');
         $output = '<textarea ' . $this->_renderAttributes($attributes) . '>';
         $output .= $this->encodeOuput($this->_content);
         $output .= '</textarea>';
         $this->addTinyMCE(true);
     } else {
         $attributes['type'] = $this->getAttribute('type');
         $attributes['maxLength'] = $this->getAttribute('maxLength');
         $attributes['size'] = $this->getAttribute('size');
         $attributes['value'] = $this->encodeOuput(is_string($this->_content) ? $this->_content : json_encode($this->_content));
         $output = '<input ' . $this->_renderAttributes($attributes) . '/>';
     }
     $label = $this->getAttributeString('label') ?: '';
     if ($label) {
         $cssClassLabel = $this->getAttribute('cssClassLabel');
         $cssClassLabel .= ($cssClassLabel ? ' ' : '') . ($this->getAttribute('required') ? 'required' : '');
         if ($this->getAttribute('wrapLabel')) {
             $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), true, $output, array('class' => $cssClassLabel), false);
             $output = '';
         } else {
             $label = org_glizy_helpers_Html::label($this->getAttributeString('label'), $this->getId(), false, '', array('class' => $cssClassLabel), false);
         }
     }
     $this->addOutputCode($this->applyItemTemplate($label, $output));
 }