Ejemplo n.º 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));
 }
Ejemplo n.º 2
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));
 }
Ejemplo n.º 3
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));
     }
 }
Ejemplo n.º 4
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);
 }
Ejemplo n.º 5
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);
     }
 }
Ejemplo n.º 6
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));
     }
 }
Ejemplo n.º 7
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));
 }