Esempio n. 1
0
 function process()
 {
     parent::process();
     $this->_content['id'] = $this->getId();
     $this->_content['cssClass'] = $this->getAttribute('cssClass');
     $this->_content['title'] = $this->getAttributeString('title');
     $this->_content['label'] = $this->getAttributeString('label');
     $this->_content['buttonLabel'] = $this->getAttributeString('buttonLabel');
     $this->_content['value'] = __Request::get('search', '');
     if (!$this->_content['buttonLabel']) {
         $this->_content['buttonLabel'] = $this->_content['label'];
     }
     $searchPageId = $this->getAttribute('searchPageId');
     if (!is_int($searchPageId)) {
         $siteMap = $this->_application->getSiteMap();
         $menu = $siteMap->getMenuByPageType($searchPageId);
         if ($menu && $menu->isVisible) {
             $this->_content['__url__'] = org_glizy_helpers_Link::makeURL('link', array('pageId' => $menu->id));
         } else {
             $this->setAttribute('visible', false);
         }
     } else {
         $this->_content['__url__'] = org_glizy_helpers_Link::makeURL('link', array('pageId' => $searchPageId));
     }
 }
Esempio n. 2
0
 function _render()
 {
     if (!empty($this->_content)) {
         $cssClass = $this->getAttribute('cssClass');
         $wrapStart = '';
         $wrapEnd = '';
         if (!is_null($this->getAttribute('wrapTag'))) {
             if (!is_null($cssClass)) {
                 $wrapperCssClass = ' class="' . $cssClass . '"';
             }
             $wrapStart = '<' . $this->getAttribute('wrapTag') . $wrapperCssClass . '>';
             $wrapEnd = '</' . $this->getAttribute('wrapTag') . '>';
         }
         $url = $this->_content;
         $label = $url;
         if (intval($url)) {
             // link interno
             $siteMap = $this->_application->getSiteMap();
             $menu = $siteMap->getNodeById($url);
             $label = $menu->title;
             $url = org_glizy_helpers_Link::makeURL('link', array('pageId' => $url));
         }
         $output = org_glizy_helpers_Link::formatLink($url, $label, NULL, $cssClass);
         return $wrapStart . $output . $wrapEnd;
     }
     return '';
 }
Esempio n. 3
0
 function recordSet2List(&$iterator, $routeUrl = '', $cssClass = array(), $maxRecord = NULL, $queryVars = array(), $getRelationValues = false)
 {
     $output = array();
     $tempCssClass = $cssClass;
     $i = 0;
     while ($iterator->hasMore()) {
         $ar =& $iterator->current();
         if ($getRelationValues) {
             $ar->setProcessRelations(true);
             $ar->buildAllRelations();
         }
         $values = $ar->getValuesAsArray($getRelationValues, true, true);
         $values = array_merge($values, $queryVars);
         if (!count($tempCssClass)) {
             $tempCssClass = $cssClass;
         }
         if (count($tempCssClass)) {
             $values['__cssClass__'] = array_shift($tempCssClass);
         }
         $values['__url__'] = org_glizy_helpers_Link::makeURL($routeUrl, $values);
         $output[] = $values;
         $iterator->next();
         $i++;
         if (!is_null($maxRecord) && $i == $maxRecord) {
             break;
         }
     }
     return $output;
 }
Esempio n. 4
0
 /**
  * @return string
  */
 function getContent()
 {
     $output = $this->getText();
     if ($this->getAttribute('adm:htmlEditor') !== true) {
         $output = $this->encodePlainText();
         if ($this->getAttribute('forceP')) {
             $output = org_glizy_helpers_Html::forceP($output);
         }
         return $output;
     } else {
         $output = javascript_to_html($output);
         // esegue la paginazione
         if (!is_null($this->getAttribute("paginate"))) {
             $paginateClass =& $this->getAttribute("paginate");
             $this->_content = $paginateClass->splitTextResult($output);
         }
         if ($this->getAttribute('parseInternalLinks')) {
             $output = org_glizy_helpers_Link::parseInternalLinks($output);
         }
         $attributes = array();
         $attributes['id'] = $this->getId();
         $attributes['class'] = $this->getAttribute('cssClass');
         $wrapTag = $this->getAttribute('wrapTag');
         $outputTag = !empty($wrapTag) ? '<' . $wrapTag . ' ' . $this->_renderAttributes($attributes) . '>' : '';
         $outputTag .= $output;
         $outputTag .= !empty($wrapTag) ? '</' . $wrapTag . '>' : '';
         return $outputTag;
     }
 }
Esempio n. 5
0
 function render_html()
 {
     if (!__Config::get('MULTILANGUAGE_ENABLED')) {
         return false;
     }
     $iterator = org_glizy_ObjectFactory::createModelIterator('org.glizycms.core.models.Language', 'all', array('order' => 'language_order'));
     if ($iterator->count() > 1) {
         $output = '<ul class="' . $this->getAttribute('cssClass') . '" id="' . $this->getId() . '">';
         if ($this->getAttribute('separator') == 'start') {
             $output .= '<li class="separator">|</li>';
         }
         foreach ($iterator as $ar) {
             $url = __Link::addParams(array('language' => $ar->language_code));
             if ($ar->language_id == $this->_application->getLanguageId()) {
                 $output .= '<li class="' . $ar->language_code . '">' . org_glizy_helpers_Link::makeSimpleLink(glz_encodeOutput($ar->language_name), $url, '', 'active') . '</li>';
             } else {
                 $output .= '<li class="' . $ar->language_code . '">' . org_glizy_helpers_Link::makeSimpleLink(glz_encodeOutput($ar->language_name), $url) . '</li>';
             }
         }
         if ($this->getAttribute('separator') == 'end') {
             $output .= '<li>|</li>';
         }
         $output .= '</ul>';
         $this->addOutputCode($output);
     }
 }
Esempio n. 6
0
 function process()
 {
     $this->_content = new org_glizy_components_BreadcrumbsVO();
     $this->_content->label = $this->getAttribute('label');
     $this->_content->separator = $this->getAttribute('separator');
     $this->_content->cssClass = $this->getAttribute('cssClass');
     $menuId = $this->getAttribute('menuId');
     $siteMap =& $this->_application->getSiteMap();
     $currentMenu = is_null($menuId) ? $this->_application->getCurrentMenu() : $siteMap->getNodeById($menuId);
     if ($this->extraItem) {
         array_unshift($this->_content->records, '<span class="' . $this->getAttribute('cssCurrent') . '">' . $this->extraItem . '</span>');
     }
     while (true) {
         if ($currentMenu->type != 'SYSTEM') {
             $nodeTitle = empty($currentMenu->titleLink) ? $currentMenu->title : $currentMenu->titleLink;
             $nodeDescription = empty($currentMenu->linkDescription) ? $nodeTitle : $currentMenu->linkDescription;
             if (count($this->_content->records)) {
                 if (empty($currentMenu->url)) {
                     array_unshift($this->_content->records, org_glizy_helpers_Link::makeLink('link', array('pageId' => $currentMenu->id, 'title' => $nodeDescription, 'label' => $nodeTitle)));
                 } else {
                     array_unshift($this->_content->records, org_glizy_helpers_Link::makeSimpleLink($nodeTitle, $currentMenu->url, $nodeDescription));
                 }
             } else {
                 array_unshift($this->_content->records, '<span class="' . $this->getAttribute('cssCurrent') . '">' . $nodeTitle . '</span>');
             }
         }
         if ($currentMenu->parentId === 0 || !$currentMenu->parentId) {
             break;
         }
         $tempNode =& $currentMenu->parentNode();
         $currentMenu =& $tempNode;
     }
 }
Esempio n. 7
0
 function render_html()
 {
     if ($this->getAttribute('logoutPageId')) {
         $output = org_glizy_helpers_Link::makeLink('link', array('pageId' => $this->getAttribute('logoutPageId'), 'title' => $this->getAttribute('label'), 'cssClass' => $this->getAttribute('cssClass'), 'icon' => $this->getAttribute('icon')));
         $this->addOutputCode($output);
     }
 }
Esempio n. 8
0
 /**
  * Process
  *
  * @return	boolean	false if the process is aborted
  * @access	public
  */
 function process()
 {
     if (!$this->_application->canViewPage()) {
         org_glizy_Session::set('glizy.loginUrl', org_glizy_helpers_Link::scriptUrl());
         org_glizy_helpers_Navigation::gotoUrl(org_glizy_helpers_Link::makeUrl('accessDenied'));
     }
     $this->processChilds();
 }
Esempio n. 9
0
 function render_html()
 {
     if ($this->getAttribute('renderHtml')) {
         $tag = $this->getAttribute('wrapTag');
         $label = (!empty($tag) ? '<' . $tag . '>' : '') . $this->getAttribute('title') . (!empty($tag) ? '</' . $tag . '>' : '');
         $output = org_glizy_helpers_Link::makeLink('link', array('cssClass' => $this->getAttribute('cssClass'), 'label' => $label, 'pageId' => $this->_content));
         $this->addOutputCode($output);
     }
 }
Esempio n. 10
0
 function getContent()
 {
     $tagContent = trim($this->getText());
     if ($this->getAttribute('makeLink') && !empty($tagContent)) {
         return org_glizy_helpers_Link::makeSimpleLink($tagContent, $tagContent);
     } else {
         return $tagContent;
     }
 }
Esempio n. 11
0
 protected function processResult($result)
 {
     $this->directOutput = true;
     if (is_array($result) && $result['errors']) {
         return $result;
     } else {
         $application =& org_glizy_ObjectValues::get('org.glizy', 'application');
         $url = org_glizy_helpers_Link::makeUrl($this->getRedirectUrl(), array('pageId' => $application->getPageId()));
         return array('url' => $url);
     }
 }
Esempio n. 12
0
 function getItem()
 {
     $acl = $this->getAttribute('acl');
     if (!empty($acl)) {
         list($service, $action) = explode(',', $acl);
         if (!$this->_user->acl($service, $action)) {
             return false;
         }
     }
     $value = strtolower($this->getAttribute('value'));
     $label = $this->getAttribute('label');
     $url = $this->getAttribute('url');
     $routeUrl = $this->getAttribute('routeUrl');
     $cssClass = $this->getAttribute('cssClass');
     if ($routeUrl) {
         $title = $label;
         if ($cssClass) {
             $label = '<i class="' . $cssClass . '"></i>' . $label;
         }
         $label = $this->addWrap($label);
         $url = org_glizy_helpers_Link::makeLink($routeUrl, array('pageId' => $value, 'title' => $title, 'label' => $label), array(), '', false);
         $condition = $this->getAttribute('selected');
         if (!$condition) {
             $condition = $value;
         }
         $condition = explode(',', $condition);
         if (count($condition) > 1) {
             $selected = false;
             for ($i = 0; $i < count($condition); $i++) {
                 if (__Request::get($condition[$i]) == $condition[$i + 1]) {
                     $selected = true;
                     break;
                 }
                 $i++;
             }
         } else {
             $selected = $value == $this->_application->getPageId();
         }
         return array('url' => $url, 'selected' => $selected);
     } else {
         if ($url) {
             return array('url' => org_glizy_helpers_Link::makeSimpleLink($this->addWrap($label), $url, $label, $cssClass), 'selected' => $value == __Request::get('__url__'));
         } else {
             if ($value) {
                 $url = org_glizy_helpers_Link::makeLink($value, array('label' => $this->addWrap($label), 'title' => $label, 'cssClass' => $cssClass), array(), '', false);
                 return array('url' => $url, 'selected' => $value == __Request::get('__url__'));
             } else {
                 return array('url' => '<span class="' . $cssClass . '">' . $label . '</span>', 'selected' => false);
             }
         }
     }
 }
Esempio n. 13
0
 function render()
 {
     // $this->addOutputCode( org_glizy_helpers_JS::linkJSfile(__Paths::get('APPLICATION').'templates/js/bootstrap.min.js' ) );
     $output = '<div class="btn-group">' . '<a class="btn dropdown-toggle action-link" data-toggle="dropdown" href="#">' . '<i class="icon-plus"></i> ' . $this->getAttribute('label') . '</a>' . '<ul class="dropdown-menu left forced-left-position">';
     $routeUrl = $this->getAttribute('routeUrl');
     $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.Entity', 'all');
     foreach ($it as $ar) {
         $params = array('entityTypeId' => $ar->getId());
         $url = org_glizy_helpers_Link::makeUrl($routeUrl, $params);
         $output .= '<li><a href="' . $url . '">' . $ar->entity_name . '</a></li>';
     }
     $output .= '</ul>' . '</div>';
     $this->addOutputCode($output);
 }
Esempio n. 14
0
 protected function loadContentFromDB()
 {
     if (!$this->_application->canViewPage()) {
         //$this->setAttribute('templateFileName', 'accessDenaied' );
         org_glizy_Session::set('glizy.loginUrl', org_glizy_helpers_Link::scriptUrl());
         org_glizy_helpers_Navigation::gotoUrl(org_glizy_helpers_Link::makeUrl('accessDenied'));
     }
     // if ($this->_user->backEndAccess && org_glizy_Request::get( 'draft', '' ) == '1')
     // {
     // 	$versionStatus = 'DRAFT';
     // }
     // TODO gestire lo stato PUBLISHED E DRAFT
     $contentProxy = org_glizy_ObjectFactory::createObject('org.glizycms.contents.models.proxy.ContentProxy');
     $this->_content = $contentProxy->readContentFromMenu($this->_application->getPageId(), org_glizy_ObjectValues::get('org.glizy', 'languageId'));
 }
Esempio n. 15
0
 function _render_html()
 {
     if ($this->_content['mediaId'] > 0) {
         $linkTitle = $this->getAttribute('linkTitle');
         $linkTitle = str_replace('#title#', $this->_content['title'], $linkTitle);
         $linkTitle = str_replace('#size#', org_glizy_helpers_String::formatFileSize($this->media->size), $linkTitle);
         $originalFileName = $this->media->originalFileName;
         $part = explode('.', $originalFileName);
         $type = '';
         if (count($part) > 1) {
             $type = strtoupper($part[count($part) - 1]);
         }
         $linkTitle = str_replace('#format#', $type, $linkTitle);
         $this->_content['linkTitle'] = $linkTitle;
         $this->_content['__url__'] = org_glizy_helpers_Media::getFileUrlById($this->media->id, $this->getAttribute('directUrl'));
         $this->_content['__html__'] = org_glizy_helpers_Link::makeSimpleLink($this->_content['title'], $this->_content['__url__'], $linkTitle, $this->getAttribute('cssClass'), $this->getAttribute('rel'));
     }
 }
Esempio n. 16
0
 function render_html()
 {
     $output = '<ul id="' . $this->getId() . '"' . (!is_null($this->getAttribute('cssClass')) ? ' class="' . $this->getAttribute('cssClass') . '"' : '') . '>';
     foreach ($this->_items as $item) {
         $output .= '<li';
         $output .= $item['selected'] ? ' ' . $this->getAttribute('attributeToSelect') . '="' . $this->getAttribute('cssClassCurrent') . '">' : '>';
         if (isset($item['url'])) {
             $output .= $item['url'];
         } else {
             if (!empty($item['key'])) {
                 $output .= org_glizy_helpers_Link::makeLink($item['key'], array('title' => $item['value'], 'cssClass' => @$item['cssClass']), array(), '', false);
             } else {
                 $output .= $item['value'];
             }
         }
         $output .= '</li>';
     }
     $output .= '</ul>';
     $this->addOutputCode($output);
 }
Esempio n. 17
0
 function process()
 {
     $this->_content = array();
     $this->_content['label'] = $this->getAttribute('label');
     $this->_content['cssClass'] = $this->getAttribute('cssClass');
     $this->_content['current'] = '';
     $this->_content['records'] = array();
     $iterator = org_glizy_ObjectFactory::createModelIterator('org.glizycms.core.models.Language');
     $iterator->orderBy('language_order');
     if ($iterator->count()) {
         $editLanguageId = $this->_application->getEditingLanguageId();
         foreach ($iterator as $ar) {
             if ($ar->language_id == $editLanguageId) {
                 $this->_content['current'] = $ar->language_name;
                 continue;
             }
             $url = org_glizy_helpers_Link::addParams(array('switchLanguage' => $ar->language_id));
             $this->_content['records'][] = org_glizy_helpers_Link::makeSimpleLink(glz_encodeOutput($ar->language_name), $url, $ar->language_name);
         }
     }
 }
Esempio n. 18
0
 public function executeLater($email)
 {
     if ($this->submit && $this->controller->validate()) {
         $ar = org_glizy_ObjectFactory::createModel('org.glizy.models.User');
         if (!$ar->find(array('user_email' => $email))) {
             // utente non trovato
             $this->view->validateAddError(__T('MW_LOSTPASSWORD_ERROR'));
             return false;
         }
         // utente trovato
         // genera una nuova password e la invia per email
         glz_import('org.glizy.helpers.Mail');
         // invia la notifica all'utente
         $subject = org_glizy_locale_Locale::get('MW_LOSTPASSWORD_EMAIL_SUBJECT');
         $body = org_glizy_locale_Locale::get('MW_LOSTPASSWORD_EMAIL_BODY');
         $body = str_replace('##USER##', $email, $body);
         $body = str_replace('##HOST##', org_glizy_helpers_Link::makeSimpleLink(GLZ_HOST, GLZ_HOST), $body);
         $body = str_replace('##PASSWORD##', $ar->user_password, $body);
         org_glizy_helpers_Mail::sendEmail(array('email' => org_glizy_Request::get('email', ''), 'name' => $ar->user_firstName . ' ' . $ar->user_lastName), array('email' => org_glizy_Config::get('SMTP_EMAIL'), 'name' => org_glizy_Config::get('SMTP_SENDER')), $subject, $body);
         $this->changeAction('lostPasswordConfirm');
     }
 }
Esempio n. 19
0
 /**
  * Render
  *
  * @return	void
  * @access	public
  */
 function render_html()
 {
     $url = $this->getAttribute('url');
     $cssClass = $this->getAttribute('cssClass');
     $wrapStart = '';
     $wrapEnd = '';
     if (!is_null($this->getAttribute('wrapTag'))) {
         if (!is_null($cssClass)) {
             $wrapperCssClass = ' class="' . $cssClass . '"';
         } else {
             $wrapperCssClass = '';
         }
         $wrapStart = '<' . $this->getAttribute('wrapTag') . $wrapperCssClass . '>';
         $wrapEnd = '</' . $this->getAttribute('wrapTag') . '>';
     }
     if (is_null($url)) {
         $output = org_glizy_helpers_Link::makeLink2($this->getAttribute('routeUrl'), $this->_content, array('class' => $cssClass, 'id' => $this->getId()));
     } else {
         $output = org_glizy_helpers_Link::makeSimpleLink($this->_content['label'], $url, '', $cssClass, '', array('target' => $this->getAttribute('target'), 'icon' => $this->getAttribute('icon'), 'id' => $this->getId()));
     }
     $this->addOutputCode($wrapStart . $output . $wrapEnd);
 }
Esempio n. 20
0
 function process()
 {
     $this->recordId = org_glizy_Request::get($this->getAttribute('idName'), NULL);
     if (is_null($this->recordId)) {
         return;
     }
     $dataProvider =& $this->getAttribute('dataProvider');
     $ar =& $dataProvider->getNewObject();
     $versionFieldName = $ar->getVersionFieldName();
     $languageFieldName = $ar->getLanguageFieldName();
     if (is_null($versionFieldName)) {
         $ar->load($this->recordId, $this->getAttribute('query'));
         $this->_content = $ar->getValuesAsArray($this->getAttribute('getRelations'), true);
     } else {
         $query = $this->getAttribute('query');
         if (is_null($query)) {
             $result = $ar->find(array($ar->getPrimaryKey() => $this->recordId, $versionFieldName => 'PUBLISHED', $languageFieldName => $this->_application->getLanguageId()));
         } else {
             $result = $ar->load($this->recordId, null, $query);
         }
         if (!$result) {
             // TODO
             // record non trovato
         } else {
             $this->_content = $ar->getValuesAsArray($this->getAttribute('getRelations'));
         }
     }
     $this->_content['__url__'] = !is_null($this->getAttribute('routeUrl')) ? org_glizy_helpers_Link::makeURL($this->getAttribute('routeUrl'), $this->_content) : '';
     // crea i figli
     if ($this->getAttribute('createModelComponents')) {
         $this->canHaveChilds = true;
         $className = $dataProvider->getRecordClassName();
         $this->createChildsFromModel($className);
         $this->processChilds();
         $this->canHaveChilds = false;
     }
 }
Esempio n. 21
0
 function getJSAction($action, $forceUrl = true)
 {
     $pageId = $this->_application->getPageId();
     $targetPage = $this->getAttribute('targetPage');
     if (!is_null($targetPage)) {
         $pageId = $this->getAttribute('targetPage');
     }
     if ($forceUrl) {
         $url = '\'' . org_glizy_helpers_Link::makeUrl('link', array('pageId' => $pageId), array($this->_stateName => $action)) . '\'';
     } else {
         $url = '\'' . org_glizy_helpers_Link::addParams(array($this->_stateName => $action)) . '\'';
     }
     return $url;
 }
Esempio n. 22
0
 private function prepareText($value)
 {
     $value->text = org_glizy_helpers_Link::parseInternalLinks($value->text);
     $value->textAfter = org_glizy_helpers_Link::parseInternalLinks($value->textAfter);
 }
Esempio n. 23
0
 function _makeNavigationMenu(&$node, $endDepth, &$menu, $skip = false)
 {
     $skip = !$skip ? $node->depth < $this->_startDepth : $skip;
     if ($node->type == 'BLOCK') {
         return true;
     }
     if ($node->depth > $endDepth) {
         return true;
     }
     if ($node->isVisible == 0) {
         return true;
     }
     if (is_string($node->isVisible) && preg_match("/\\{php\\:.*\\}/i", $node->isVisible)) {
         $phpcode = org_glizy_helpers_PhpScript::parse($node->isVisible);
         if (!eval($phpcode)) {
             return true;
         }
     }
     if ($node->type == 'SYSTEM' && !$skip) {
         return true;
     }
     if (!$this->_application->canViewPage($node->id)) {
         return true;
     }
     $nodeTitle = empty($node->titleLink) ? $node->title : $node->titleLink;
     $nodeDescription = empty($node->linkDescription) ? $nodeTitle : $node->linkDescription;
     $menuNode = array();
     if (!$skip) {
         $menuNode['id'] = $node->id;
         $menuNode['title'] = $nodeTitle;
         $menuNode['label'] = $nodeDescription;
         $menuNode['depth'] = $node->depth;
         $menuNode['type'] = $node->pageType;
         $menuNode['cssClass'] = $node->cssClass;
         $menuNode['haveChild'] = $node->hasChildNodes();
         if ($this->_currentMenuId == $node->id && !$this->getAttribute('forceLink')) {
             $menuNode['node'] = $nodeTitle;
         } else {
             $cssClass = $this->getAttribute('selectLink') && $this->_currentMenuId == $node->id ? $this->getAttribute('cssCurrent') : '';
             if (empty($node->url)) {
                 $linkParams = array('pageId' => $node->id, 'title' => $nodeDescription, 'label' => $nodeTitle, 'cssClass' => $cssClass, 'icon' => $node->icon);
                 $menuNode['node'] = org_glizy_helpers_Link::makeLink('link', $linkParams);
             } else {
                 $url = $node->url;
                 if (strpos($url, 'route:') !== false) {
                     $url = substr($url, 6);
                     $url = __Routing::makeUrl($url, __Request::getAllAsArray());
                 }
                 $menuNode['node'] = org_glizy_helpers_Link::makeSimpleLink($nodeTitle, $url, $nodeDescription, $cssClass);
             }
         }
         if (!$this->getAttribute('selectLink')) {
             if (!$this->getAttribute('selectParent')) {
                 $menuNode['selected'] = $this->_currentMenuId == $node->id ? ' ' . $this->getAttribute('attributeToSelect') . '="' . $this->getAttribute('cssCurrent') . '"' : '';
             } else {
                 $parentNode =& $this->_currentMenu->parentNodeByDepth($node->depth);
                 if (is_object($parentNode) && $node->depth > 1) {
                     $menuNode['selected'] = $parentNode->id == $node->id || $this->_currentMenuId == $node->id ? ' ' . $this->getAttribute('attributeToSelect') . '="' . $this->getAttribute('cssCurrent') . '"' : '';
                 }
             }
         }
     }
     if (count($menuNode)) {
         $menu[] = $menuNode;
     }
     if ($node->hasChildNodes()) {
         $childNodes =& $node->childNodes();
         $tempMenu = array();
         for ($i = 0; $i < count($childNodes); $i++) {
             $newEndDepth = max($this->_endDepth + (in_array($node->id, $this->_menuToOpen) ? 1 : 0), $node->depth + (in_array($node->id, $this->_menuToOpen) ? 1 : 0));
             if ($this->getAttribute('showOnlyChilds')) {
                 if (in_array($node->id, $this->_menuToOpen) || $this->_startMenu->depth == $node->depth || $this->_currentMenuId == $node->id || $this->getAttribute('drawAllChilds')) {
                     $this->_makeNavigationMenu($childNodes[$i], $newEndDepth, $tempMenu);
                 }
             } else {
                 $this->_makeNavigationMenu($childNodes[$i], $newEndDepth, $tempMenu);
             }
         }
         if (count($tempMenu)) {
             $menuNode['node'] = $tempMenu;
             $menuNode['selected'] = '';
             if ($this->getAttribute('flat') && count($menu)) {
                 $menu = array_merge($menu, $menuNode['node']);
             } else {
                 $menu[] = $menuNode;
             }
         }
     }
     if ($skip && count($menu)) {
         $menu = $menu[0]['node'];
     }
 }
Esempio n. 24
0
 function process_ajax()
 {
     $onlyFolder = __Request::get('onlyFolder');
     $command = __Request::get('command');
     $path = ltrim(__Request::get('path'), '/');
     $customPath = __Request::get('customPath');
     $enableDownload = __Request::get('enableDownload');
     $result = array();
     if ($command == "read") {
         $path = utf8_decode($path);
         if (!$customPath) {
             $mappingService = $this->_application->retrieveProxy('org.glizycms.mediaArchive.services.MediaMappingService');
             if ($path == '') {
                 $mappings = $mappingService->getAllMappings();
                 foreach ($mappings as $mappingName => $mappingTarget) {
                     $result[] = array('type' => 'dir', 'name' => $mappingName, 'path' => $mappingName, 'icon' => 'folder');
                 }
                 return $result;
             }
             $slashPos = strpos($path, '/');
             if ($slashPos == false) {
                 $dir = $mappingService->getMapping($path);
             } else {
                 $name = substr($path, 0, $slashPos);
                 $dir = $mappingService->getMapping($name) . substr($path, $slashPos);
             }
         } else {
             $dir = $customPath . $path;
         }
         $result[] = array('type' => 'dir', 'name' => 'root/', 'path' => '', 'icon' => 'folder');
         $files = glob($dir . '/*');
         if (!empty($files)) {
             $filter = $this->getAttribute('filter');
             foreach ($files as $file_name) {
                 $file_name = str_replace($dir . '/', '', $file_name);
                 if ($file_name == ".") {
                     continue;
                 }
                 if ($file_name == ".." && $path == '') {
                     continue;
                 }
                 if ($file_name[0] == "." && $file_name[1] != ".") {
                     continue;
                 }
                 // nasconde i file che iniziano col punto
                 // se è settato un filtro sull'estensione dei file, allora non mostra i file che non hanno come estensione quella specificata nel filtro
                 if (!is_dir($dir . '/' . $file_name) && $filter != '' && pathinfo($file_name, PATHINFO_EXTENSION) != $filter) {
                     continue;
                 }
                 $fullPath = $dir . '/' . $file_name;
                 $fullPath2 = $path . '/' . $file_name;
                 if (is_dir($fullPath)) {
                     if ($file_name == "..") {
                         $fullPath2 = dirname(dirname($fullPath2));
                     }
                     if ($fullPath2 == '/' || $fullPath2 == '.') {
                         $fullPath2 = '';
                     }
                     $result[] = array('type' => 'dir', 'name' => utf8_encode($file_name), 'path' => ltrim(utf8_encode($fullPath2), '/'), 'icon' => 'folder');
                 } else {
                     if (!$onlyFolder) {
                         $sizeInBytes = filesize($fullPath);
                         $extension = strtolower(pathinfo($fullPath, PATHINFO_EXTENSION));
                         $iconType = array('jpg' => 'image', 'jpeg' => 'image', 'gif' => 'image', 'png' => 'image', 'pdf' => 'pdf', 'flv' => 'video', 'mp4' => 'video', 'm4v' => 'video', 'mp3' => 'audio');
                         $icon = isset($iconType[$extension]) ? $iconType[$extension] : 'other';
                         if ($enableDownload) {
                             $name = org_glizy_helpers_Link::makeSimpleLink($file_name, $fullPath, '', '', '', array('download' => $file_name));
                         } else {
                             $name = utf8_encode($file_name);
                         }
                         $result[] = array('type' => 'file', 'name' => $name, 'path' => utf8_encode($fullPath2), 'size' => $this->formatSize($sizeInBytes), 'icon' => $icon, 'date' => date('H:i:s d/m/Y', filemtime($fullPath)));
                     }
                 }
             }
         }
     }
     return $result;
 }
Esempio n. 25
0
 function goHere()
 {
     /** @var org_glizy_application_Application $application */
     $application =& org_glizy_ObjectValues::get('org.glizy', 'application');
     org_glizy_helpers_Navigation::gotoUrl(org_glizy_helpers_Link::makeUrl('link', array('pageId' => $application->getPageId())));
 }
Esempio n. 26
0
 protected function makeUrl($pageId, $title)
 {
     return org_glizy_helpers_Link::makeUrl('link', array('pageId' => $pageId, 'title' => $title));
 }
Esempio n. 27
0
 public function __get($name)
 {
     $value = $this->content->{$name};
     if (is_string($value) && strrpos($value, '<') !== false) {
         // TODO migliorare
         $value = org_glizy_helpers_Link::parseInternalLinks($value);
     }
     return $value;
 }
Esempio n. 28
0
 protected function makeUrl($entityTypeId, $document_id)
 {
     return org_glizy_helpers_Link::makeUrl('showEntityDetail', array('entityTypeId' => $entityTypeId, 'document_id' => $document_id));
 }
Esempio n. 29
0
 function render_html_onStart()
 {
     $attributes = array();
     $attributes['id'] = $this->getId();
     if (!is_null($this->getAttribute('action'))) {
         $attributes['action'] = $this->getAttribute('action');
     } else {
         $removeValues = $this->getAttribute('removeGetValues');
         if ($removeValues === true || $removeValues == 'true') {
             $attributes['action'] = org_glizy_Routing::scriptUrl(true);
         } else {
             $attributes['action'] = org_glizy_helpers_Link::removeParams(explode(',', $removeValues));
         }
     }
     $attributes['method'] = $this->getAttribute('method');
     $attributes['onsubmit'] = $this->getAttribute('onsubmit');
     $attributes['class'] = $this->getAttribute('cssClass');
     $attributes['enctype'] = $this->getAttribute('enctype');
     $output = '<form ' . $this->_renderAttributes($attributes) . '>';
     if ($this->getAttribute('fieldset')) {
         $output .= '<fieldset>';
     }
     // $output .= org_glizy_helpers_Html::applyItemTemplate('',
     // 				org_glizy_helpers_Html::hidden($this->getId().'_command', $this->getAttribute('command') ),
     // 				true );
     $this->addOutputCode($output);
 }
Esempio n. 30
0
 function changeStateUrl($newState = '', $amp = false)
 {
     if (is_null($this->getAttribute('targetPage'))) {
         return org_glizy_helpers_Link::makeUrl('linkChangeAction', array('pageId' => $this->_application->getPageId(), $this->actionName => $newState));
     } else {
         return org_glizy_helpers_Link::makeUrl('link', array('pageId' => $this->getAttribute('targetPage')), array($this->actionName => $newState));
     }
 }