Beispiel #1
0
 public function process()
 {
     if ($this->getAttribute('global')) {
         $templateXml = 'TemplateAdminGlobal';
         $menuId = 0;
     } else {
         $templateXml = 'TemplateAdmin';
         $menuId = __Request::get('menuId', __Request::get('__id'));
         if (!$menuId) {
             // TODO ERRORE
         }
     }
     $templateProxy = org_glizy_ObjectFactory::createObject('org.glizycms.template.models.proxy.TemplateProxy');
     $templateName = $templateProxy->getSelectedTemplate();
     if (!$templateName) {
         // TODO ERRORE
     }
     $templateProxy->loadTemplateLocale();
     // legge i dati del template
     $data = $templateProxy->getEditDataForMenu($menuId, __Request::exists('loadFromParent'));
     $customTemplate = $templateProxy->getTemplateCustomClass();
     if ($customTemplate && method_exists($customTemplate, 'updateTemplateData')) {
         $customTemplate->updateTemplateData($data);
     }
     $this->setData($data);
     $this->addDefaultComponents();
     $templateRealPath = $templateProxy->getTemplateRealpath();
     if ($templateRealPath) {
         org_glizy_ObjectFactory::attachPageToComponent($this, $this->_application, $templateXml, $templateRealPath . '/', array('idPrefix' => $this->getId() . '-', 'skipImport' => true, 'mode' => 'edit'), $this->getId() . '-');
         parent::process();
         // TODO visualizzare che non ci sono parametri di personalizzazione
     }
 }
Beispiel #2
0
 function execute_step3($oldState)
 {
     if (strtolower(__Request::get('action', '')) != 'next') {
         // in fase di modifica il nome del modulo
         // viene passato in get
         if (__Request::exists('mbTable') && __Request::exists('mbName') && __Request::exists('mod')) {
             // cambia il tiolo della pagina
             $c = $this->_parent->getComponentById("pageTitle");
             $c->setAttribute('value', __T('Modifica modulo'));
             $c->process();
             // imposta altri valori dal file info
             $builder = org_glizy_ObjectFactory::createObject('movio.modules.modulesBuilder.builder.Builder');
             $values = file_get_contents($builder->getCustomModulesFolder() . '/Info');
             $values = unserialize($values);
             __Request::set('fieldOrder', $values['fieldOrder']);
             __Request::set('fieldRequired', $values['fieldRequired']);
             __Request::set('fieldType', $values['fieldType']);
             __Request::set('fieldSearch', $values['fieldSearch']);
             __Request::set('fieldListSearch', $values['fieldListSearch']);
             __Request::set('fieldAdmin', $values['fieldAdmin']);
             __Request::set('fieldLabel', $values['fieldLabel']);
             __Request::set('mbModuleType', isset($values['mbModuleType']) ? $values['mbModuleType'] : 'document');
             __Request::set('mbTableDB', $values['tableDb']);
         }
     }
 }
Beispiel #3
0
 public function executeLater()
 {
     if ($this->submit && $this->controller->validate()) {
         $email = org_glizy_Request::get('user_email', '');
         $ar = org_glizy_ObjectFactory::createModel('org.glizy.models.User');
         if ($ar->find(array('user_loginId' => $email))) {
             // TODO tradurre
             $this->view->validateAddError('L\'email è già presente nel database, usare un\'altra email o richiedere la password');
             return;
         }
         $fields = $ar->getFields();
         foreach ($fields as $k => $v) {
             if (__Request::exists($k)) {
                 $ar->{$k} = __Request::get($k);
             }
         }
         $ar->user_FK_usergroup_id = __Config::get('USER_DEFAULT_USERGROUP');
         $ar->user_isActive = __Config::get('USER_DEFAULT_ACTIVE_STATE');
         $ar->user_password = glz_password(__Request::get('user_password'));
         $ar->user_loginId = $email;
         $ar->user_email = $email;
         $ar->user_dateCreation = new org_glizy_types_DateTime();
         $ar->save();
         $this->changeAction('registrationConfirm');
     }
 }
Beispiel #4
0
 public function executeLater()
 {
     if ($this->user->isLogged() && $this->submit && $this->controller->validate()) {
         $ar = org_glizy_ObjectFactory::createModel('org.glizy.models.User');
         $ar->load($this->user->id);
         $email = org_glizy_Request::get('user_email', '');
         if ($email != $ar->user_loginId) {
             $ar2 = org_glizy_ObjectFactory::createModel('org.glizy.models.User');
             if ($ar2->find(array('user_loginId' => $email)) && $ar2->user_id != $ar->user_id) {
                 $this->view->validateAddError('L\'email è già presente nel database, usare un\'altra email');
                 return;
             }
         }
         // TODO migliorare così siamo esposti a problemi di sicurezza
         $fields = $ar->getFields();
         foreach ($fields as $k => $v) {
             if ($k == 'user_password') {
                 continue;
             }
             if (__Request::exists($k)) {
                 $ar->{$k} = __Request::get($k);
             }
         }
         $password = __Request::get('user_password');
         if ($password) {
             $ar->user_password = glz_password($password);
         }
         $ar->user_loginId = $email;
         $ar->user_email = $email;
         $ar->save();
         $this->changeAction('modifyConfirm');
     }
 }
Beispiel #5
0
 function process()
 {
     // check if the user is already logged
     if ($this->_user->isLogged()) {
         $this->setAttribute('visible', false);
         $this->redirectAfterLogin();
     }
     $submitId = 'submit_' . $this->getId();
     $this->_content['id'] = $this->getId();
     $this->_content['submitName'] = $submitId;
     $this->_content['errorLabel'] = '';
     $this->_content['cssClass'] = $this->getAttribute('cssClass');
     $this->_content['userLabel'] = $this->getAttribute('userLabel');
     $this->_content['userField'] = $this->getAttribute('userField');
     $this->_content['passwordLabel'] = $this->getAttribute('passwordLabel');
     $this->_content['passwordField'] = $this->getAttribute('passwordField');
     $this->_content['registrationPage'] = $this->getAttribute('registrationPage');
     $this->_content['registrationLabel'] = $this->getAttribute('registrationLabel');
     $this->_content['confirmLabel'] = $this->getAttribute('confirmLabel');
     $this->_content['rememberLabel'] = $this->getAttribute('rememberLabel');
     $this->_content['askPasswordLabel'] = $this->getAttribute('askPasswordLabel');
     $this->_content['title'] = $this->getAttributeString('title');
     $this->_content['__url__'] = org_glizy_helpers_Link::makeURL($this->getAttribute('registrationUrl'));
     $this->_content['askPasswordUrl'] = org_glizy_helpers_Link::makeURL($this->getAttribute('askPasswordUrl'));
     if (__Request::exists($this->_content['userField']) || __Request::exists($this->_content['passwordField'])) {
         $authClass = org_glizy_ObjectFactory::createObject(__Config::get('glizy.authentication'));
         if ($authClass) {
             try {
                 $allowGroups = $this->getAttribute('allowGroups') != '' ? explode(',', $this->getAttribute('allowGroups')) : array();
                 $authClass->setAllowGroups($allowGroups);
                 $authClass->setOnlyBackendUser($this->getAttribute('backend'));
                 $authClass->setUserLanguage(__Request::get($this->getAttribute('languageField')));
                 $authClass->loginFromRequest($this->getAttribute('userField'), $this->getAttribute('passwordField'), $this->getAttribute('rememberField'), true);
                 $this->redirectAfterLogin();
             } catch (org_glizy_authentication_AuthenticationException $e) {
                 switch ($e->getCode()) {
                     case org_glizy_authentication_AuthenticationException::EMPTY_LOGINID_OR_PASSWORD:
                     case org_glizy_authentication_AuthenticationException::WRONG_LOGINID_OR_PASSWORD:
                         $this->_content['errorLabel'] = $this->getAttribute('errorLabel');
                         break;
                     case org_glizy_authentication_AuthenticationException::USER_NOT_ACTIVE:
                     case org_glizy_authentication_AuthenticationException::ACCESS_NOT_ALLOWED:
                         $this->_content['errorLabel'] = org_glizy_locale_Locale::get('GLZ_LOGIN_DISABLED');
                         break;
                 }
             }
         } else {
             // TODO mostrare errore
             $this->_content['errorLabel'] = __Config::get('glizy.authentication');
         }
     } else {
         $this->_content['errorLabel'] = org_glizy_Session::get('glizy.loginError', '');
         org_glizy_Session::remove('glizy.loginError');
     }
 }
Beispiel #6
0
 function execute()
 {
     if (__Request::exists('next')) {
         $pageType = $this->application->getPageType();
         list($moduleName) = explode('.', $pageType);
         __Request::set('mbTable', $moduleName);
         $builder = org_glizy_ObjectFactory::createObject('movio.modules.modulesBuilder.builder.Builder');
         $builder->executeDelete();
         org_glizy_helpers_Navigation::gotoUrl(__Link::makeUrl('link', array('pageId' => 'glizycms_contentsedit')));
     }
 }
Beispiel #7
0
 function init()
 {
     $this->defineAttribute('applyFormItemTemplate', false, true, COMPONENT_TYPE_BOOLEAN);
     $this->defineAttribute('validationType', false, '', COMPONENT_TYPE_STRING);
     $this->defineAttribute('validationMessage', false, '', COMPONENT_TYPE_STRING);
     parent::init();
     // se c'è un binding lo imposta per poterlo rileggere
     $name = $this->getAttribute('name');
     $name = empty($name) ? $this->getOriginalId() : $name;
     $bindToField = $this->getAttribute('bindTo');
     if (!empty($bindToField) && !__Request::exists($bindToField)) {
         __Request::set($bindToField, __Request::get($name));
     }
     if (!$this->_application->isAdmin()) {
         $this->addValidatorClass();
     }
 }
 function build($params = array())
 {
     $this->_reset();
     $parentId = $this->_parent->getId();
     if (!is_null($parentId)) {
         $this->_newRecord = empty($parentId);
         if (!$this->_newRecord) {
             if ($this->record->find(array('contentplugin_FK_id' => $parentId, 'contentplugin_objectName' => $this->_objectName))) {
                 if (__Request::exists($this->_bindTo[0])) {
                     return;
                 }
                 $values = unserialize($this->record->contentplugin_value);
                 if (is_array($values)) {
                     foreach ($values as $k => $v) {
                         if (in_array($k, $this->_bindTo)) {
                             $this->_parent->{$k} = $v;
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #9
0
 function process_ajax()
 {
     $aColumns = array();
     foreach ($this->columns as $column) {
         if (!in_array($column['columnName'], $aColumns)) {
             $aColumns[] = $column['columnName'];
         }
     }
     $sSearch = __Request::get('sSearch');
     $filters = array();
     $it = org_glizy_ObjectFactory::createModelIterator($this->getAttribute('recordClassName'));
     if ($it->getArType() === 'document') {
         $it->setOptions(array('type' => 'PUBLISHED_DRAFT'));
     }
     if ($this->getAttribute('setFiltersToQuery')) {
         for ($i = 0; $i < count($aColumns); $i++) {
             if (__Request::get('sSearch_' . $i)) {
                 $filters[$aColumns[$i]] = __Request::get('sSearch_' . $i);
             } else {
                 if ($sSearch != '' && __Request::get('bSearchable_' . $i) == "true") {
                     $filters[$aColumns[$i]] = $sSearch;
                 }
             }
         }
         $it->load($this->getAttribute('query'), array('filters' => $filters));
     } else {
         $it->load($this->getAttribute('query'));
         if (method_exists($it, 'showAll')) {
             $it->showAll();
         }
         if ($this->getAttribute('fullTextSearch') && $sSearch) {
             $it->where('fulltext', '%' . $sSearch . '%', 'ILIKE');
         } else {
             for ($i = 0; $i < count($aColumns); $i++) {
                 if (__Request::get('sSearch_' . $i)) {
                     $filters[$aColumns[$i]] = array('value' => __Request::get('sSearch_' . $i), 'condition' => 'LIKE');
                 } else {
                     if ($sSearch != '' && __Request::get('bSearchable_' . $i) == "true") {
                         $filters[$aColumns[$i]] = array('value' => '%' . $sSearch . '%', 'condition' => 'LIKE');
                     }
                 }
             }
             if (!empty($filters)) {
                 if ($this->getAttribute('queryOperator') === 'OR') {
                     $it->setOrFilters($filters);
                 } else {
                     $it->setFilters($filters);
                 }
             }
         }
     }
     // Ordering
     if (__Request::exists('iSortCol_0')) {
         $iSortingCols = intval(__Request::get('iSortingCols'));
         for ($i = 0; $i < $iSortingCols; $i++) {
             if (__Request::get('bSortable_' . intval(__Request::get('iSortCol_' . $i))) == "true") {
                 $order = $aColumns[intval(__Request::get('iSortCol_' . $i))];
                 $order_dir = __Request::get('sSortDir_' . $i);
                 $it->orderBy($order, $order_dir);
                 break;
             }
         }
     }
     // Paging
     if (__Request::get('iDisplayStart', -1) != -1) {
         $it->limit(array(__Request::get('iDisplayStart'), __Request::get('iDisplayLength', -1)));
     }
     $aaData = array();
     if ($this->getAttribute('dbDebug')) {
         org_glizy_dataAccessDoctrine_DataAccess::enableLogging();
     }
     try {
         foreach ($it as $row) {
             $rowToInsert = array();
             foreach ($this->columns as $column) {
                 if ($column['acl']) {
                     if (!$this->_user->acl($column['acl']['service'], $column['acl']['action'])) {
                         continue;
                     }
                 }
                 $value = $row->{$column}['columnName'];
                 if ($column['renderCell']) {
                     if (!is_object($column['renderCell'])) {
                         $column['renderCell'] = org_glizy_ObjectFactory::createObject($column['renderCell'], $this->_application);
                     }
                     if (is_object($column['renderCell'])) {
                         $value = $column['renderCell']->renderCell($row->getId(), $value, $row, $column['columnName']);
                     }
                 }
                 if (is_object($value)) {
                     $value = json_encode($value);
                 }
                 $rowToInsert[] = $value;
             }
             $aaData[] = $rowToInsert;
         }
     } catch (Exception $e) {
         var_dump($e);
     }
     if ($this->getAttribute('dbDebug')) {
         org_glizy_dataAccessDoctrine_DataAccess::disableLogging();
         die;
     }
     $output = array("sEcho" => intval(__Request::get('sEcho')), "iTotalRecords" => $it->count(), "iTotalDisplayRecords" => $it->count(), "aaData" => $aaData);
     return $output;
 }
Beispiel #10
0
 /**
  * @param string $route
  * @param array  $queryVars
  * @param array  $addParam
  *
  * @return mixed|string
  */
 static function _makeURL_SEF($route = '', $queryVars = array(), $addParam = array())
 {
     if (!isset($addParam['__modal__']) && __Request::exists('__modal__')) {
         $addParam['__modal__'] = __Request::get('__modal__');
     }
     $url = '';
     if (!empty($route)) {
         $configArray =& org_glizy_Routing::_getValuesArray();
         /** @var org_glizy_application_Application $application */
         $application =& org_glizy_ObjectValues::get('org.glizy', 'application');
         /** @var org_glizy_application_SiteMap $siteMap */
         $siteMap =& $application->getSiteMap();
         $isApplicationDB = $siteMap->getType() == 'db';
         // TODO
         // controllare se il route richiesto esiste.
         //
         // TODO
         // ci sono molte classi che usano lo stesso concetto di memorizzare
         // i dati in un array statico
         // conviene fare una classe base e estendere questa
         //
         $routing = $configArray[strtolower($route)];
         if (isset($routing[0])) {
             foreach ($routing as $v) {
                 if ($queryVars[$v['keyName']] == $v['keyValue'] || empty($v['keyValue'])) {
                     $url = $v['value'];
                     break;
                 }
             }
         } else {
             $url = $routing['value'];
         }
         if (strpos($url, 'http://') !== false) {
             return $url;
         }
         $pageId = 0;
         preg_match_all("|\\{(.*)\\}|U", $url, $match, PREG_PATTERN_ORDER);
         for ($i = 0; $i < count($match[0]); $i++) {
             $sanitize = true;
             $value = '';
             $value2 = '';
             $command = explode('=', $match[1][$i]);
             switch ($command[0]) {
                 case 'language':
                     $value = isset($queryVars['language']) ? $queryVars['language'] : $application->getLanguage();
                     break;
                 case '*':
                 case 'currentMenu':
                     $page =& $application->getCurrentMenu();
                     $value = $page->id;
                     $value2 = $page->title;
                     unset($page);
                     break;
                 case 'currentMenuId':
                     $page =& $application->getCurrentMenu();
                     $value = $page->id;
                     unset($page);
                     break;
                 case 'pageId':
                     // ricerca la pagina da linkare
                     if (count($command) > 1) {
                         if (is_numeric($command[1])) {
                             $page = $siteMap->getNodeById($command[1]);
                         } else {
                             $page = $siteMap->getMenuByPageType($command[1]);
                             if (is_null($page)) {
                                 $module = org_glizy_Modules::getModule($command[1]);
                                 if (!is_null($module) && $module->pageType) {
                                     $page = $siteMap->getMenuByPageType($module->pageType);
                                 }
                             }
                         }
                         $value = $page->id;
                         $value2 = $isApplicationDB ? $page->title : '';
                     } else {
                         $pageId = @$queryVars[$command[0]];
                         if (empty($pageId)) {
                             $page =& $application->getCurrentMenu();
                             $pageId = $page->id;
                             unset($page);
                         }
                         $value = $pageId;
                         $value2 = '';
                     }
                     break;
                 case 'pageTitle':
                     // ricerca la pagina da linkare
                     if (!isset($queryVars['title'])) {
                         // TODO
                         // non deve instanziare un nuovo menù altrimenti rilegge tutto dal db ogni volta
                         $page = $siteMap->getNodeById($pageId);
                         $value = $page->title;
                     } else {
                         $value = $queryVars['title'];
                     }
                     break;
                 case 'value':
                 case 'integer':
                     $value = isset($queryVars[$command[1]]) ? $queryVars[$command[1]] : __Request::get($command[1], '');
                     break;
                 case 'static':
                     $value = '';
                     break;
                 case 'config':
                     $sanitize = false;
                     $value = __Config::get($command[1]);
                     break;
                 default:
                     $value = $command[1];
                     break;
             }
             if (is_string($value) && empty($value)) {
                 $url = str_replace($match[0][$i] . '/', '', $url);
                 $url = str_replace($match[0][$i], '', $url);
                 continue;
             }
             if ($sanitize) {
                 $value = glz_sanitizeUrlTitle($value) . ($value2 != '' ? '/' : '');
                 $value2 = glz_sanitizeUrlTitle($value2);
             }
             $url = str_replace($match[0][$i], $value . $value2, $url);
         }
         // aggiunge in coda i valori della query string che non sono usati
         if (is_array($addParam) && count($addParam)) {
             $url .= self::$baseUrlParam;
             foreach ($addParam as $k => $v) {
                 $url .= '&' . $k . '=' . urlencode($v);
             }
         } else {
             if (is_string($addParam)) {
                 $url .= $addParam;
             }
         }
     }
     $url = !empty($url) ? $url : $route;
     return !preg_match('/^(javascript:|http:|https:)/', $url) ? self::$baseUrl . $url : $url;
 }
Beispiel #11
0
 /**
  * Render
  *
  * @return	void
  * @access	public
  */
 function render($outputMode = NULL, $skipChilds = false)
 {
     $from = '';
     $until = '';
     $set = '';
     $limitStart = 0;
     if (__Request::exists('resumptionToken')) {
         if (!__Request::exists('from') && !__Request::exists('until') && !__Request::exists('set') && !__Request::exists('metadataPrefix')) {
             // TODO controllare la data di scadenza del token
             $tokenId = __Request::get('resumptionToken');
             $fileName = __Paths::get('CACHE') . $tokenId;
             if (file_exists($fileName)) {
                 $info = unserialize(file_get_contents($fileName));
                 $limitStart = $info['limitEnd'];
                 $filters = $info['filters'];
                 $metadataPrefix = $info['metadataPrefix'];
             } else {
                 $this->_application->setError('badResumptionToken', '', $tokenId);
                 return;
             }
         } else {
             $this->_application->setError('exclusiveArgument');
             return;
         }
     } else {
         // controlla i parametri ricevuti
         if (__Request::exists('from')) {
             $from = __Request::get('from');
             if (!org_glizy_oaipmh_OaiPmh::checkDateFormat($from)) {
                 $this->_application->setError('badGranularity', 'from', $from);
                 return;
             }
         }
         if (__Request::exists('until')) {
             $until = __Request::get('until');
             if (!org_glizy_oaipmh_OaiPmh::checkDateFormat($until)) {
                 $this->_application->setError('badGranularity', 'until', $until);
                 return;
             }
         }
         if (__Request::exists('set')) {
             $set = __Request::get('set');
         }
         if (__Request::exists('metadataPrefix')) {
             $metadataPrefix = __Request::get('metadataPrefix');
         } else {
             $this->_application->setError('missingArgument', 'metadataPrefix');
             return;
         }
         $filters = array();
         if ($from) {
             $filters[] = 'picoqueue_date >= ' . org_glizy_dataAccess_DataAccess::qstr($from);
         }
         if ($until) {
             $filters[] = 'picoqueue_date <= ' . org_glizy_dataAccess_DataAccess::qstr($until);
         }
         if ($set) {
             $filters[] = 'picoqueue_recordModule = ' . org_glizy_dataAccess_DataAccess::qstr($set);
         }
     }
     $metadata = $this->_application->getMetadataFormat();
     if (isset($metadata[$metadataPrefix])) {
         // TODO
         //$inc_record = $metadata[$metadataPrefix]['myhandler'];
     } else {
         $this->_application->setError('cannotDisseminateFormat', 'metadataPrefix', $metadataPrefix);
         return;
     }
     $limitLength = __Config::get('oaipmh.maxRecords');
     $it = org_glizy_ObjectFactory::createModelIterator('org.glizy.oaipmh.models.PicoQueue', 'all', array('filters' => $filters, 'limit' => array($limitStart, $limitLength), 'numRows' => true));
     $num_rows = $it->count();
     if ($num_rows > 0) {
         $oaiPrefix = __Config::get('oaipmh.oaiPrefix');
         $countrec = 0;
         $output = '<ListRecords>';
         $output .= org_glizy_oaipmh_OaiPmh::createResumptionToken('ListRecords', array('numRows' => $num_rows, 'limitStart' => $limitStart, 'limitEnd' => $limitStart + $limitLength, 'filters' => $filters, 'metadataPrefix' => $metadataPrefix));
         while ($it->hasMore()) {
             $countrec++;
             $arC = $it->current();
             $it->next();
             $setClass = org_glizy_ObjectFactory::createObject($arC->picoqueue_recordModule, $this->_application);
             if (is_null($setClass)) {
                 continue;
             }
             $setClass->loadRecord($arC->picoqueue_recordId);
             $identifier = $oaiPrefix . $arC->picoqueue_identifier;
             $datestamp = org_glizy_oaipmh_OaiPmh::formatDatestamp($arC->picoqueue_date);
             $status_deleted = $arC->picoqueue_action == 'delete' ? true : false;
             $output .= '<record>';
             $output .= '<header';
             if ($status_deleted) {
                 $output .= ' status="deleted"';
             }
             $output .= '>';
             // use xmlrecord since we use stuff from database
             $output .= '<identifier>' . org_glizy_oaipmh_OaiPmh::encode($identifier) . '</identifier>';
             $output .= '<datestamp>' . org_glizy_oaipmh_OaiPmh::encode($datestamp) . '</datestamp>';
             if (!$status_deleted) {
                 $output .= '<setSpec>' . org_glizy_oaipmh_OaiPmh::encode($arC->picoqueue_recordModule) . '</setSpec>';
             }
             $output .= '</header>';
             $output .= '<metadata>';
             $output .= $setClass->getRecord($identifier);
             $output .= '</metadata>';
             $output .= '</record>';
         }
         $output .= '</ListRecords>';
         $this->addOutputCode($output);
     } else {
         $this->_application->setError('noRecordsMatch');
     }
 }
Beispiel #12
0
 /**
  * Render
  *
  * @return	void
  * @access	public
  */
 function render($outputMode = NULL, $skipChilds = false)
 {
     if (__Request::exists('identifier')) {
         $identifier = __Request::get('identifier');
         if (!org_glizy_oaipmh_OaiPmh::is_valid_uri($identifier)) {
             $this->_application->setError('badArgument', 'identifier', $identifier);
             return;
         }
     } else {
         $this->_application->setError('missingArgument', 'identifier');
         return;
     }
     if (__Request::exists('metadataPrefix')) {
         $metadataPrefix = __Request::get('metadataPrefix');
         $metadata = $this->_application->getMetadataFormat();
         if (isset($metadata[$metadataPrefix])) {
             //TODO
             //$inc_record = $metadata[$metadataPrefix]['myhandler'];
         } else {
             $this->_application->setError('cannotDisseminateFormat', 'metadataPrefix', $metadataPrefix);
             return;
         }
     } else {
         $this->_application->setError('missingArgument', 'metadataPrefix');
         return;
     }
     $id = str_replace(__Config::get('oaipmh.oaiPrefix'), '', $identifier);
     if ($id == '') {
         $this->_application->setError('idDoesNotExist', '', $identifier);
         return;
     }
     $this->loadeRecord($id);
     if ($this->arPico && $this->setClass) {
         if ($this->setClass->loadRecord($this->arPico->picoqueue_recordId)) {
             $output = '<GetRecord>';
             $output .= '<record>';
             // header
             $datestamp = org_glizy_oaipmh_OaiPmh::formatDatestamp($this->arPico->picoqueue_date);
             $status_deleted = $this->arPico->picoqueue_action == 'delete' ? true : false;
             $output .= '<header' . ($status_deleted ? ' status="deleted"' : '') . '>';
             $output .= '<identifier>' . org_glizy_oaipmh_OaiPmh::encode($identifier) . '</identifier>';
             $output .= '<datestamp>' . org_glizy_oaipmh_OaiPmh::encode($datestamp) . '</datestamp>';
             if (!$status_deleted) {
                 $output .= '<setSpec>' . org_glizy_oaipmh_OaiPmh::encode($this->arPico->picoqueue_recordModule) . '</setSpec>';
             }
             $output .= '</header>';
             $output .= '<metadata>';
             $output .= $this->setClass->getRecord($identifier);
             $output .= '</metadata>';
             $output .= '</record>';
             $output .= '</GetRecord>';
             $this->addOutputCode($output);
         } else {
             $this->_application->setError('idDoesNotExist', '', $identifier);
             return;
         }
     } else {
         $this->_application->setError('idDoesNotExist', '', $identifier);
         return;
     }
 }
Beispiel #13
0
 /**
  * @param org_glizy_components_Component $targetComponent
  *
  * @return array
  */
 private function processAjaxCallController($targetComponent)
 {
     if (__Request::exists('controllerName')) {
         $targetComponent->setAttribute('controllerName', __Request::get('controllerName'));
     }
     $result = array('status' => false);
     $r = $targetComponent->callController();
     if ($r !== null && $r !== false) {
         if ($targetComponent->controllerDirectOutput()) {
             return $r;
         }
         $result['status'] = true;
         if (is_array($r) && isset($r['error'])) {
             $result['status'] = false;
             $result['error'] = $r['error'];
             return $result;
         }
         $outputFormatInHtml = false;
         $html = '';
         if (is_array($r) && isset($r['sendOutput'])) {
             // controlla se c'è renderizzare dei componenti da mandare all'output
             __Request::set('action', isset($r['sendOutputState']) ? $r['sendOutputState'] : '');
             $outputFormatInHtml = isset($r['sendOutputFormat']) && $r['sendOutputFormat'] == 'html';
             $this->_rootComponent->process();
             $componentsId = $r['sendOutput'];
             unset($r['sendOutput']);
             unset($r['sendOutputState']);
             if (!is_array($componentsId)) {
                 $componentsId = array($componentsId);
             }
             foreach ($componentsId as $id) {
                 $c = $this->_rootComponent->getComponentById($id);
                 if (is_object($c)) {
                     $this->_rootComponent->_output = array();
                     $c->render();
                     //$r[ 'sendOutput' ][ $id ] = $this->_output[ 0 ][ 'code' ];
                     $r[$id] = '';
                     foreach ($this->_rootComponent->_output as $o) {
                         if (strpos($o['editableRegion'], '__') !== false) {
                             continue;
                         }
                         $r[$id] .= $o['code'];
                         $html .= $o['code'];
                     }
                 }
             }
         }
         if ($outputFormatInHtml) {
             $result['html'] = $html;
         } else {
             $result['result'] = $r;
         }
     }
     return $result;
 }