Пример #1
0
 public function getFilterInstance(Sitengine_Controller_Request_Http $request, array $params, Zend_Session_Namespace $namespace, $usersTable)
 {
     require_once 'Sitengine/Grid/Search.php';
     $filter = new Sitengine_Grid_Search();
     $reset = $request->get($params['reset']);
     ### filter element ###
     if ($reset) {
         $filter->resetSessionVal($params['find'], $namespace);
     }
     $filter->registerSessionVal($namespace, $request, $params['find'], self::VALUE_NONESELECTED);
     # set clause
     if ($filter->getVal($params['find'])) {
         $value = $this->_database->quote($filter->getVal($params['find']));
         $value = preg_replace('/\\s+/', ' ', $value);
         $value = preg_replace('/.(.*)./', "\$1", trim($value));
         # remove quote delimiters
         $clause = "(";
         $clause .= " LOWER({$this->_name}.comment) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$usersTable}.name) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$usersTable}.firstname) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$usersTable}.lastname) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$usersTable}.nickname) LIKE LOWER('%{$value}%')";
         $clause .= ")";
         $filter->setClause($params['find'], $clause);
     }
     return $filter;
 }
Пример #2
0
 public function registerVal(Sitengine_Controller_Request_Http $request, $param, $ignore = 'noneSelected')
 {
     $value = $request->get($param);
     if ($value == $ignore) {
         $value = '';
     }
     $this->_data[$param] = array('value' => $value, 'clause' => '', 'element' => '');
 }
Пример #3
0
 protected function _getMainSection()
 {
     try {
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SESSIONID => Zend_Session::getId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS_UPLOAD);
         $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $submitUri .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         #print $submitUri;
         require_once $this->_controller->getEnv()->getContribDir() . '/FlexUpload/class.flexupload.inc.php';
         $flex = new FlexUpload($submitUri);
         $flex->setWidth('100%');
         #$flex->setHeight('100%');
         $flex->setMaxFiles(20);
         $flex->setMaxFileSize(100 * 1024 * 1024);
         $flex->setFileExtensions('*.zip;*.mp3;*.wav;*.gif;*.jpg;*.jpeg;*.pdf;*.doc;*.xls');
         $flex->setPathToSWF($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/');
         $flex->setPathToSWFObject($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/js/');
         $flex->setLocale($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/locale/en.xml');
         return array('flex' => $flex->getHTML());
     } catch (Exception $exception) {
         require_once 'Sitengine/Newsletter/Backend/Campaigns/Attachments/Exception.php';
         throw new Sitengine_Newsletter_Backend_Campaigns_Attachments_Exception('form page error', $exception);
     }
 }
Пример #4
0
 protected function _getMainSection()
 {
     try {
         $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SESSIONID => Zend_Session::getId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Frontend_Front::ROUTE_BLOGS_POSTS_FILES_UPLOAD);
         $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $submitUri .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         require_once $this->_controller->getEnv()->getContribDir() . '/FlexUpload/class.flexupload.inc.php';
         $flex = new FlexUpload($submitUri);
         $flex->setWidth('100%');
         #$flex->setHeight('100%');
         $flex->setMaxFiles(20);
         $flex->setMaxFileSize(15 * 1024 * 1024);
         $type = $this->_controller->getEntity()->getAncestorType();
         if ($type == Sitengine_Blog_Posts_Table::TYPE_GALLERY) {
             $types = '*.gif;*.jpg;*.jpeg';
         } else {
             $types = '*.zip;*.mp3;*.wav;*.gif;*.jpg;*.jpeg;*.pdf;*.doc;*.xls';
         }
         $flex->setFileExtensions($types);
         $flex->setPathToSWF($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/');
         $flex->setPathToSWFObject($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/js/');
         $flex->setLocale($this->_controller->getEnv()->getContribRequestDir() . '/FlexUpload/locale/en.xml');
         return array('flex' => $flex->getHTML());
     } catch (Exception $exception) {
         require_once 'Sitengine/Blog/Frontend/Blogs/Posts/Files/Exception.php';
         throw new Sitengine_Blog_Frontend_Blogs_Posts_Files_Exception('form page error', $exception);
     }
 }
Пример #5
0
 protected function _getMainSection()
 {
     try {
         $elements = array();
         $input = $this->_controller->getRequest()->getPost(null);
         #$valueSort = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT);
         #$valueOrder = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER);
         #$valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getPermiso()->getMembershipsTable();
         ########################################################################
         #### FILTER INPUT
         ########################################################################
         $fields = array('id' => '', 'groupId' => '', 'locked' => 0);
         if ($this->_inputMode == Sitengine_Env::INPUTMODE_UPDATE) {
             $stored = $this->_controller->getFrontController()->getPermiso()->getMembershipsTable()->complementRow($this->_controller->getEntity()->getRow());
             $data = Sitengine_Controller_Request_Http::filterUpdate(sizeof($input), $input, $fields, $stored);
             $data = array_merge($stored, $data);
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_GROUPS_MEMBERS_SHARP);
             $uri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $queryUpdate = $uri;
             $hiddens = array(Sitengine_Env::PARAM_METHOD => Sitengine_Env::METHOD_PUT, Sitengine_Env::PARAM_MDATE => $stored['mdate']);
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_GROUPS_MEMBERS_SHARP);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $stored['userId'];
         } else {
             $data = Sitengine_Controller_Request_Http::filterInsert(sizeof($input), $input, $fields);
             $hiddens = array();
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_GROUPS_MEMBERS_NEW);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $this->_controller->getTranslate()->translate('formViewInsertTitle');
         }
         #Sitengine_Debug::print_r($data);
         $data['userIdOptions'] = array_merge($this->_controller->getTranslate()->translateGroup('fieldValsUserId')->toArray(), $this->_controller->getPermiso()->getDirectory()->getAllUsers());
         #unset($data['userIdOptions'][Sitengine_Permiso::UID_ROOT]);
         unset($data['userIdOptions'][Sitengine_Permiso::UID_GUEST]);
         unset($data['userIdOptions'][Sitengine_Permiso::UID_LOSTFOUND]);
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('queryUpdate' => isset($queryUpdate) ? $queryUpdate : '', 'title' => $title, 'inputMode' => $this->_inputMode, 'hiddens' => implode('', $hiddens), 'submitUri' => $submitUri, 'DATA' => $data);
     } catch (Exception $exception) {
         require_once 'Sitengine/Permiso/Backend/Groups/Members/Exception.php';
         throw new Sitengine_Permiso_Backend_Groups_Members_Exception('form page error', $exception);
     }
 }
Пример #6
0
 protected function _getFormSection()
 {
     $input = $this->_controller->getRequest()->getPost(null);
     ########################################################################
     #### FILTER INPUT
     ########################################################################
     $fields = array('firstname' => '', 'lastname' => '', 'email' => '', 'message' => '', 'subscribeNewsletter' => 0);
     $data = Sitengine_Controller_Request_Http::filterInsert(sizeof($input), $input, $fields);
     #Sitengine_Debug::print_r($data);
     $hiddens = array();
     $args = array(Sitengine_Env::PARAM_ACTION => Sitengine_FormToMail_Default_Controller::ACTION_SENDMAIL);
     $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_FormToMail_Front::ROUTE_INDEX);
     $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
     ########################################################################
     #### COLLECT ALL DATA
     ########################################################################
     foreach ($hiddens as $k => $v) {
         $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
     }
     return array('hiddens' => implode('', $hiddens), 'submitUri' => $submitUri, 'DATA' => $data);
 }
Пример #7
0
 protected function _getMainSection()
 {
     try {
         $elements = array();
         $input = $this->_controller->getRequest()->getPost(null);
         #$valueSort = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT);
         #$valueOrder = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER);
         #$valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getBlogPackage()->getFilesTable();
         $table->setTranscript($this->_controller->getPreferences()->getTranscript());
         $transcripts = $table->getTranscripts();
         ########################################################################
         #### FILTER INPUT
         ########################################################################
         $fieldsNormal = array('id' => '', 'mdate' => '', 'sorting' => '');
         foreach ($transcripts->get() as $index => $symbol) {
             $fieldsNormal['titleLang' . $index] = '';
             $fieldsNormal['markupLang' . $index] = '';
         }
         $fieldsOnOff = array('publish' => 1);
         if ($this->_inputMode == Sitengine_Env::INPUTMODE_UPDATE) {
             require_once 'Sitengine/Form/TranscriptsPayloads.php';
             $payloads = new Sitengine_Form_TranscriptsPayloads($transcripts);
             $payloads->start($this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAYLOAD_NAME));
             $stored = $this->_controller->getFrontController()->getBlogPackage()->getFilesTable()->complementRow($this->_controller->getEntity()->getRow());
             $data = Sitengine_Controller_Request_Http::filterUpdateDeprecated(sizeof($input), $input, $fieldsNormal, $fieldsOnOff, $stored);
             $data = array_merge($stored, $data);
             # set dates to timezone
             /*
             $name = 'cdate';
             $date = new Zend_Date($stored[$name], Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             $data[$name]  = $date->get(Zend_Date::DATE_FULL).' ';
             $data[$name] .= $date->get(Zend_Date::TIME_FULL);
             */
             /*
             $name = 'mdate';
             $date = new Zend_Date($stored[$name], Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             $data[$name]  = $date->get(Zend_Date::DATE_LONG).' ';
             $data[$name] .= $date->get(Zend_Date::TIME_LONG);
             */
             $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES_SHARP);
             $queryUpdate = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $hiddens = array(Sitengine_Env::PARAM_METHOD => Sitengine_Env::METHOD_PUT, Sitengine_Env::PARAM_PAYLOAD_NAME => $payloads->getName(), Sitengine_Env::PARAM_MDATE => $stored['mdate']);
             $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES_SHARP);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $stored['titleLang' . $transcripts->getIndex()];
             $title = $title != '' ? $title : $stored['titleLang0'];
             $n = 'uri';
             $e = new Sitengine_Form_Element($n, preg_replace('/&/', '&', $stored['file1OriginalUri']));
             $e->setClass('viewFormInput');
             $e->setId('viewForm' . $n);
             $elements[$n] = $e->getText(60);
         } else {
             require_once 'Sitengine/Form/TranscriptsPayloads.php';
             $payloads = new Sitengine_Form_TranscriptsPayloads($transcripts);
             $payloads->start();
             $data = Sitengine_Controller_Request_Http::filterInsertDeprecated(sizeof($input), $input, $fieldsNormal, $fieldsOnOff);
             $gid = $this->_controller->getPermiso()->getDirectory()->getGroupId($this->_controller->getFrontController()->getBlogPackage()->getOwnerGroup());
             $data[Sitengine_Permiso::FIELD_GID] = !is_null($gid) ? $gid : Sitengine_Permiso::GID_ADMINISTRATORS;
             $data[Sitengine_Permiso::FIELD_UID] = $this->_controller->getPermiso()->getAuth()->getId();
             # set some defaults...
             $n = 'sorting';
             if (array_key_exists($n, $input)) {
                 $data[$n] = $input[$n];
             } else {
                 $q = 'SELECT MAX(sorting) AS maxSorting FROM ' . $this->_controller->getFrontController()->getBlogPackage()->getFilesTableName();
                 $q .= ' WHERE ';
                 #.Sitengine_Permiso::FIELD_OID.' = "'.$this->_controller->getPermiso()->getOrganization()->getId().'"';
                 $q .= ' parentId = "' . $this->_controller->getEntity()->getAncestorId() . '"';
                 $statement = $this->_controller->getDatabase()->prepare($q);
                 $statement->execute();
                 $result = $statement->fetchAll();
                 $data[$n] = $result[0]['maxSorting'] + 10;
             }
             $hiddens = array(Sitengine_Env::PARAM_PAYLOAD_NAME => $payloads->getName());
             $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES_NEW);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $type = $this->_controller->getEntity()->getAncestorType();
             if ($type == Sitengine_Blog_Posts_Table::TYPE_GALLERY) {
                 $title = $this->_controller->getTranslate()->translate('labelsViewformInsertPhotoTitle');
             } else {
                 $title = $this->_controller->getTranslate()->translate('labelsViewformInsertFileTitle');
             }
         }
         #Sitengine_Debug::print_r($data);
         ########################################################################
         #### ELEMENTS
         ########################################################################
         if ($payloads->isMain()) {
             /*
             if(
             	(!$data['id']) || # on insert
             	(isset($data[Sitengine_Permiso::FIELD_UID]) && $data[Sitengine_Permiso::FIELD_UID]==$this->_controller->getPermiso()->getAuth()->getId()) || # owners ok
             	#$this->_controller->getPermiso()->getUser()->hasSupervisorRights() || # supervisors ok
             	#$this->_controller->getPermiso()->getUser()->hasModeratorRights() # moderators ok
             	$this->_controller->getPermiso()->getDirectory()->userIsMember($this->_controller->getPermiso()->getAuth()->getId(), Sitengine_Permiso::GID_ADMINISTRATORS)
             )
             {
             	$n = Sitengine_Permiso::FIELD_UID;
             	$e = new Sitengine_Form_Element($n, $data[$n]);
             	$e->setClass('viewFormSelect');
             	$e->setId('viewForm'.$n);
             	$users = $this->_controller->getPermiso()->getDirectory()->getAllUsers();
             	$elements[$n] = $e->getSelect($users);
             	
             	$n = Sitengine_Permiso::FIELD_GID;
             	$e = new Sitengine_Form_Element($n, $data[$n]);
             	$e->setClass('viewFormSelect');
             	$e->setId('viewForm'.$n);
             	$groups = $this->_controller->getPermiso()->getDirectory()->getAllGroups();
             	$groups = array_merge($this->_controller->getTranslate()->translateGroup('fieldValsGid')->toArray(), $groups);
             	$elements[$n] = $e->getSelect($groups);
             	
             	$n = Sitengine_Permiso::FIELD_RAG;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_RAW;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_UAG;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_UAW;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_DAG;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_DAW;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             }
             */
             $n = 'titleLang' . $transcripts->getDefaultIndex();
             $e = new Sitengine_Form_Element($n, $data[$n]);
             $e->setClass('viewFormInput');
             $e->setId('viewForm' . $n);
             $elements['title'] = $e->getText(40);
             $n = 'publish';
             $e = new Sitengine_Form_Element($n, '1');
             $e->setClass('viewFormCheckbox');
             $e->setId('viewForm' . $n);
             $elements[$n] = $e->getCheckbox($data[$n]);
             $n = 'sorting';
             $e = new Sitengine_Form_Element($n, $data[$n]);
             $e->setClass('viewFormInput');
             $e->setId('viewForm' . $n);
             $elements[$n] = $e->getText(5);
             $n = 'file1Original';
             $e = new Sitengine_Form_Element($n);
             $e->setClass('viewFormFile');
             $e->setId('viewForm' . $n);
             $elements[$n] = $e->getFile(40);
         }
         $n = 'titleLang' . $payloads->getTranscriptIndex();
         $e = new Sitengine_Form_Element($n, $data[$n]);
         $e->setClass('viewFormInput');
         $e->setId('viewForm' . $n);
         $elements['title'] = $e->getText(40);
         #$n = 'markupLang'.$payloads->getTranscriptIndex();
         #$elements['markup'] = $this->_makeTextarea($n, $data[$n]);
         $n = 'markupLang' . $payloads->getTranscriptIndex();
         $e = new Sitengine_Form_Element($n, $data[$n]);
         $e->setClass('viewFormTextarea');
         $e->setId('markupTextarea');
         $elements['markup'] = $e->getTextarea(40, 10);
         ########################################################################
         #### CONTENT PAYLOAD SECTION TITLE
         ########################################################################
         $contentSectionTitle = $this->_controller->getTranslate()->translate('labelsViewformContentSectionTitleDefault');
         if (sizeof($transcripts->get()) > 1) {
             if (!$payloads->isMain()) {
                 $symbol = $payloads->getTranscriptSymbol();
             } else {
                 $symbol = $transcripts->getDefaultSymbol();
             }
             $contentSectionTitle .= ' (' . $this->_controller->getTranslate()->translate('languages' . ucfirst($symbol)) . ')';
         }
         ########################################################################
         #### PAYLOAD NAV DATA
         ########################################################################
         $payloadNav = array();
         if ($this->_inputMode == Sitengine_Env::INPUTMODE_UPDATE) {
             $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
             $query = array(Sitengine_Env::PARAM_PAYLOAD_NAME => $payloads->getMainName());
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES_SHARP);
             $uri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $uri .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
             $payloadNav[$payloads->getMainName()] = array('uri' => $uri, 'label' => $this->_controller->getTranslate()->translate('labelsViewformPayloadNavTitleMain'));
             $count = 0;
             foreach ($transcripts->get() as $index => $symbol) {
                 # skip default transcript because all fields are available in the overview
                 if ($count) {
                     $currentPayload = $payloads->getTranscriptNamePrefix() . '_' . $symbol;
                     $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
                     $query = array(Sitengine_Env::PARAM_PAYLOAD_NAME => $currentPayload);
                     $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES_SHARP);
                     $uri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
                     $uri .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
                     if (sizeof($transcripts->get()) > 1) {
                         $label = $this->_controller->getTranslate()->translate('languages' . ucfirst($symbol));
                     } else {
                         $label = $this->_controller->getTranslate()->translate('labelsViewformContentSectionTitleDefault');
                     }
                     $payloadNav[$currentPayload] = array('uri' => $uri, 'label' => $label);
                 }
                 $count++;
             }
         }
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('payloadName' => $payloads->getName(), 'payloadIsMain' => $payloads->isMain(), 'payloadIsDefaultTranscript' => $payloads->isDefaultTranscript(), 'queryUpdate' => isset($queryUpdate) ? $queryUpdate : '', 'title' => $title, 'contentSectionTitle' => $contentSectionTitle, 'inputMode' => $this->_inputMode, 'hiddens' => implode('', $hiddens), 'submitUri' => $submitUri, 'ELEMENTS' => $elements, 'PAYLOADNAV' => $payloadNav, 'DATA' => $data);
     } catch (Exception $exception) {
         require_once 'Sitengine/Blog/Backend/Blogs/Posts/Files/Exception.php';
         throw new Sitengine_Blog_Backend_Blogs_Posts_Files_Exception('form page error', $exception);
     }
 }
Пример #8
0
 protected function _doBatchUpdateAction()
 {
     try {
         $this->_start();
         if (!$this->getPermiso()->getAcl()->privateAccessGranted($this->getFrontController()->getPermiso()->getAuthorizedGroups())) {
             return $this->_forwardToLogin();
         }
         require_once 'Sitengine/Http.php';
         if (!Sitengine_Http::checkReferer()) {
             require_once 'Sitengine/Permiso/Backend/Users/Memberships/Exception.php';
             throw new Sitengine_Permiso_Backend_Users_Memberships_Exception('bad request', Sitengine_Env::ERROR_BAD_REQUEST);
         }
         if (!$this->getEntity()->start()) {
             return $this->_forwardToLogin();
         }
         $modifier = $this->_getModifierModelInstance();
         $updated = 0;
         $rows = Sitengine_Controller_Request_Http::getModifiedRows($_POST);
         /*
         $tables = array(
             $this->getFrontController()->getPermiso()->getUsersTableName() => 'READ',
             $this->getFrontController()->getPermiso()->getMembershipsTableName() => 'WRITE'
         );
         */
         if (sizeof($rows) > 0) {
             /*
             # lock tables
             require_once 'Sitengine/Sql.php';
             $q = Sitengine_Sql::getLockQuery($tables);
             $this->getDatabase()->getConnection()->exec($q);
             */
             foreach ($rows as $id => $data) {
                 $affectedRows = $modifier->updateFromList($id, $data, $this->getFrontController()->getPermiso()->getAuthorizedGroups());
                 if ($affectedRows > 0) {
                     $updated++;
                 } else {
                     $this->_markedRows[$id] = 1;
                 }
             }
             #$this->getDatabase()->getConnection()->exec('UNLOCK TABLES');
             if ($updated < sizeof($rows)) {
                 $this->getStatus()->set(Sitengine_Env::STATUS_ERRORBATCHUPDATE, $this->getTranslate()->translate(Sitengine_Env::STATUS_ERRORBATCHUPDATE), true);
                 return $this->_goToAction(self::ACTION_INDEX);
             } else {
                 if (sizeof($rows) > 0) {
                     $this->getStatus()->set(Sitengine_Env::STATUS_OKBATCHUPDATE, $this->getTranslate()->translate(Sitengine_Env::STATUS_OKBATCHUPDATE), false);
                 }
             }
         }
         $this->getStatus()->save();
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SORT => $this->getRequest()->get(Sitengine_Env::PARAM_SORT), Sitengine_Env::PARAM_ORDER => $this->getRequest()->get(Sitengine_Env::PARAM_ORDER));
         $route = $this->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_USERS_MEMBERSHIPS);
         $uri = $this->getRequest()->getBasePath() . '/' . $route->assemble($args);
         $uri .= Sitengine_Controller_Request_Http::makeNameValueQuery($query, '&');
         $this->getResponse()->setRedirect($uri);
         $this->getResponse()->sendResponse();
         print ' ';
     } catch (Exception $exception) {
         throw $this->_prepareErrorHandler($exception);
     }
 }
Пример #9
0
 protected function _doBatchUnlinkAction()
 {
     try {
         $this->_start();
         if (!$this->getPermiso()->getAcl()->privateAccessGranted($this->getFrontController()->getProtoPackage()->getAuthorizedGroups())) {
             return $this->_forwardToLogin();
         }
         require_once 'Sitengine/Http.php';
         if (!Sitengine_Http::checkReferer()) {
             require_once 'Sitengine/Proto/Backend/Goodies/Shouldies/Exception.php';
             throw new Sitengine_Proto_Backend_Goodies_Shouldies_Exception('bad request', Sitengine_Env::ERROR_BAD_REQUEST);
         }
         if (!$this->getEntity()->start()) {
             return $this->_forwardToLogin();
         }
         $deleted = 0;
         $rows = Sitengine_Controller_Request_Http::getSelectedRows($_POST);
         if (sizeof($rows) > 0) {
             foreach ($rows as $id => $v) {
                 $filename = isset($_POST['FILENAME' . $id]) ? $_POST['FILENAME' . $id] : null;
                 $file = $this->getTempDir() . '/' . $filename;
                 if ($filename !== null && is_writeable($file) && unlink($file)) {
                     $deleted++;
                 } else {
                     $this->_markedRows[$id] = 1;
                 }
             }
             if ($deleted < sizeof($rows)) {
                 $this->getStatus()->set(Sitengine_Env::STATUS_ERRORBATCHUNLINK, $this->getTranslate()->translate(Sitengine_Env::STATUS_ERRORBATCHUNLINK), true);
                 return $this->_goToAction(self::ACTION_ASSIGN);
             } else {
                 if (sizeof($rows) > 0) {
                     $this->getStatus()->set(Sitengine_Env::STATUS_OKBATCHUNLINK, $this->getTranslate()->translate(Sitengine_Env::STATUS_OKBATCHUNLINK), false);
                 }
             }
         }
         $this->getStatus()->save();
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->getEntity()->getAncestorId());
         $route = $this->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_ASSIGN);
         $uri = $this->getRequest()->getBasePath() . '/' . $route->assemble($args);
         $this->getResponse()->setRedirect($uri);
         $this->getResponse()->sendResponse();
         print ' ';
     } catch (Exception $exception) {
         throw $this->_prepareErrorHandler($exception);
     }
 }
Пример #10
0
 protected function _getMainSection()
 {
     try {
         $valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getNewsletterPackage()->getCampaignsTable();
         $filter = $table->getFilterInstance($this->_controller->getRequest(), array('type' => Sitengine_Newsletter_Frontend_Campaigns_Controller::PARAM_FILTER_BY_TYPE, 'find' => Sitengine_Newsletter_Frontend_Campaigns_Controller::PARAM_FILTER_BY_FIND, 'reset' => Sitengine_Newsletter_Frontend_Campaigns_Controller::PARAM_FILTER_RESET), $this->_controller->getNamespace());
         $sorting = $table->getSortingInstance($this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT), $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER));
         ########################################################################
         #### SETTINGS
         ########################################################################
         $settingsIsActive = false;
         $settingsElements = array();
         ### ipp element ###
         $defaultIpp = 20;
         $valueIpp = $this->_controller->getPreferences()->getItemsPerPage();
         $valueIpp = is_numeric($valueIpp) ? $valueIpp : $defaultIpp;
         $valueIpp = $valueIpp <= 100 && $valueIpp >= 1 ? $valueIpp : $defaultIpp;
         # set html input element
         $ippValues = array('' => $this->_controller->getTranslate()->translate('indexViewSettingsSectionItemsPerPage'), 5 => 5, 10 => 10, 20 => 20, 50 => 50, 100 => 100);
         $e = new Sitengine_Form_Element(Sitengine_Env::PARAM_IPP, $valueIpp);
         $e->setId('settings' . Sitengine_Env::PARAM_IPP);
         $e->setClass('settingsSelect');
         $settingsElements[Sitengine_Env::PARAM_IPP] = $e->getSelect($ippValues);
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $settingsData = array('isActive' => $settingsIsActive, 'hiddens' => implode('', $hiddens), 'ELEMENTS' => $settingsElements);
         ########################################################################
         #### FILTER
         ########################################################################
         $e = new Sitengine_Form_Element(Sitengine_Newsletter_Frontend_Campaigns_Controller::PARAM_FILTER_BY_FIND, $filter->getVal(Sitengine_Newsletter_Frontend_Campaigns_Controller::PARAM_FILTER_BY_FIND));
         $e->setId('filter' . Sitengine_Newsletter_Frontend_Campaigns_Controller::PARAM_FILTER_BY_FIND);
         $e->setClass('filterText');
         $filter->setElement(Sitengine_Newsletter_Frontend_Campaigns_Controller::PARAM_FILTER_BY_FIND, $e->getText(20));
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Newsletter_Frontend_Campaigns_Controller::PARAM_FILTER_RESET => 1);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Frontend_Front::ROUTE_CAMPAIGNS);
         $uriReset = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
         $uriReset .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $filterData = array('isActive' => $filter->isActive(), 'uriReset' => $uriReset, 'hiddens' => implode('', $hiddens), 'ELEMENTS' => $filter->getElements());
         ########################################################################
         #### SORTING
         ########################################################################
         $queries = array();
         foreach ($sorting->getOrdering() as $field => $order) {
             $query = array(Sitengine_Env::PARAM_SORT => $field, Sitengine_Env::PARAM_ORDER => $order);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Frontend_Front::ROUTE_CAMPAIGNS);
             $queries[$field] = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
             $queries[$field] .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         }
         $sortingData = array('QUERIES' => $queries, 'COLUMNS' => $sorting->getColumns());
         ########################################################################
         #### PAGER
         ########################################################################
         $pager = new Sitengine_Grid_Pager($valuePage, $valueIpp);
         ########################################################################
         #### LISTQUERY
         ########################################################################
         $name = $this->_controller->getFrontController()->getNewsletterPackage()->getCampaignsTableName();
         $whereClauses = array($this->_controller->getPermiso()->getDac()->getReadAccessSql($this->_controller->getFrontController()->getNewsletterPackage()->getAuthorizedGroups(), $name, false), $filter->getSql(''));
         $select = $table->select()->order($sorting->getClause())->limit($valueIpp, $pager->getOffset());
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         $items = $table->fetchAll($select);
         # if current page is out of bounds - go to beginning of list
         if (!$items->count() && $pager->getCurrPage() > 1) {
             $pager = new Sitengine_Grid_Pager(1, $valueIpp);
             $select = $table->select()->order($sorting->getClause())->limit($valueIpp, 0);
             foreach ($whereClauses as $clause) {
                 if ($clause) {
                     $select->where($clause);
                 }
             }
             $items = $table->fetchAll($select);
         }
         # count total number of records
         $select = $table->select()->from($table, array('COUNT(*) AS count'));
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         $count = $table->fetchRow($select);
         $pager->calculate($count->count);
         ########################################################################
         #### LISTDATA
         ########################################################################
         $list = array();
         foreach ($items as $item) {
             $row = $table->complementRow($item);
             #Sitengine_Debug::print_r($row);
             # uris
             $args = array(Sitengine_Env::PARAM_ID => $row['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Frontend_Front::ROUTE_CAMPAIGNS_SHARP);
             $row['uriUpdate'] = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $list[] = $row;
         }
         ########################################################################
         #### PAGER DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getPrevPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Frontend_Front::ROUTE_CAMPAIGNS);
         $uriPrevPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
         $uriPrevPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getNextPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Frontend_Front::ROUTE_CAMPAIGNS);
         $uriNextPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
         $uriNextPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $currPageInput = new Sitengine_Form_Element(Sitengine_Env::PARAM_PAGE, $pager->getCurrPage());
         $currPageInput->setClass('pagerInput');
         $pagerData = array('hiddens' => implode('', $hiddens), 'currPageInput' => $currPageInput->getText(2), 'currPage' => $pager->getCurrPage(), 'nextPage' => $pager->getNextPage(), 'prevPage' => $pager->getPrevPage(), 'numPages' => $pager->getNumPages(), 'numItems' => $pager->getNumItems(), 'firstItem' => $pager->getFirstItem(), 'lastItem' => $pager->getLastItem(), 'uriPrevPage' => $uriPrevPage, 'uriNextPage' => $uriNextPage);
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         return array('FILTER' => $filterData, 'SETTINGS' => $settingsData, 'SORTING' => $sortingData, 'DATA' => $list, 'PAGER' => $pagerData);
     } catch (Exception $exception) {
         require_once 'Sitengine/Newsletter/Frontend/Campaigns/Exception.php';
         throw new Sitengine_Newsletter_Frontend_Campaigns_Exception('list page error', $exception);
     }
 }
Пример #11
0
 public function getFilterInstance(Sitengine_Controller_Request_Http $request, array $params, Zend_Session_Namespace $namespace)
 {
     require_once 'Sitengine/Grid/Search.php';
     $filter = new Sitengine_Grid_Search();
     $reset = $request->get($params['reset']);
     ### filter element ###
     if ($reset) {
         $filter->resetSessionVal($params['type'], $namespace);
     }
     $filter->registerSessionVal($namespace, $request, $params['type'], self::VALUE_NONESELECTED);
     # set clause
     if ($filter->getVal($params['type'])) {
         $value = $this->getAdapter()->quote($filter->getVal($params['type']));
         $clause = "{$this->_name}.type = {$value}";
         $filter->setClause($params['type'], $clause);
     }
     ### filter element ###
     if ($reset) {
         $filter->resetSessionVal($params['find'], $namespace);
     }
     $filter->registerSessionVal($namespace, $request, $params['find'], self::VALUE_NONESELECTED);
     # set clause
     if ($filter->getVal($params['find'])) {
         $value = $this->getAdapter()->quote($filter->getVal($params['find']));
         $value = preg_replace('/\\s+/', ' ', $value);
         $value = preg_replace('/.(.*)./', "\$1", trim($value));
         # remove quote delimiters
         $clause = "(";
         $clause .= "LOWER({$this->_name}.titleLang0) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$this->_name}.markupLang0) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$this->_name}.titleLang1) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$this->_name}.markupLang1) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$this->_name}.file1OriginalSource) LIKE LOWER('%{$value}%')";
         $clause .= ")";
         $filter->setClause($params['find'], $clause);
     }
     return $filter;
 }
Пример #12
0
 public function getQueries()
 {
     $queries = array();
     $args = array(Sitengine_Env::PARAM_LOGOUT => 1);
     $queries['signOut'] = $this->getRequest()->getBasePath() . '/backend/proto/goodies' . Sitengine_Controller_Request_Http::makeNameValueQuery($args);
     $queries['backendHome'] = $this->getEnv()->getMyProjectRequestDir() . '/backend/home';
     $queries['protoBackendGoodies'] = $this->getRequest()->getBasePath() . '/backend/proto/goodies';
     return $queries;
 }
Пример #13
0
 protected function _doBatchUnlinkAction()
 {
     try {
         $this->_start();
         if (!$this->getPermiso()->getAcl()->privateAccessGranted($this->getFrontController()->getNewsletterPackage()->getAuthorizedGroups())) {
             return $this->_forwardToLogin();
         }
         require_once 'Sitengine/Http.php';
         if (!Sitengine_Http::checkReferer()) {
             require_once 'Sitengine/Newsletter/Backend/Campaigns/Attachments/Exception.php';
             throw new Sitengine_Newsletter_Backend_Campaigns_Attachments_Exception('bad request', Sitengine_Env::ERROR_BAD_REQUEST);
         }
         if (!$this->getEntity()->start()) {
             return $this->_forwardToLogin();
         }
         $deleted = 0;
         $rows = Sitengine_Controller_Request_Http::getSelectedRows($_POST);
         if (sizeof($rows) > 0) {
             foreach ($rows as $id => $v) {
                 $filename = isset($_POST['FILENAME' . $id]) ? $_POST['FILENAME' . $id] : null;
                 $file = $this->getTempDir() . '/' . $filename;
                 if ($filename !== null && is_writeable($file) && unlink($file)) {
                     $deleted++;
                 } else {
                     $this->_markedRows[$id] = 1;
                 }
             }
             if ($deleted < sizeof($rows)) {
                 $this->getStatus()->set(Sitengine_Env::STATUS_ERRORBATCHUNLINK, $this->getTranslate()->translate(Sitengine_Env::STATUS_ERRORBATCHUNLINK), true);
             } else {
                 if (sizeof($rows) > 0) {
                     $this->getStatus()->set(Sitengine_Env::STATUS_OKBATCHUNLINK, $this->getTranslate()->translate(Sitengine_Env::STATUS_OKBATCHUNLINK), false);
                 }
             }
         }
         return $this->_goToAction(self::ACTION_ASSIGN);
     } catch (Exception $exception) {
         throw $this->_prepareErrorHandler($exception);
     }
 }
Пример #14
0
 public function doBatchUpdateAction()
 {
     try {
         $this->_start();
         if (!$this->getPermiso()->getAcl()->privateAccessGranted($this->_authorizedGroups)) {
             return $this->_forwardToLogin();
         }
         require_once 'Sitengine/Http.php';
         if (!Sitengine_Http::checkReferer()) {
             require_once 'Sitengine/Sitemap/Backend/Exception.php';
             throw new Sitengine_Sitemap_Backend_Exception('bad request', Sitengine_Env::ERROR_BAD_REQUEST);
         }
         if (!$this->_startEntity()) {
             return $this->_forwardToLogin();
         }
         $modifier = $this->_getModifierModelInstance();
         $updated = 0;
         $rows = Sitengine_Controller_Request_Http::getModifiedRows($_POST);
         /*
         $tables = array(
             $this->getFrontController()->getSitemapPackage()->getTableSitemap() => 'WRITE'
         );
         */
         if (sizeof($rows) > 0) {
             /*
             # lock tables
             require_once 'Sitengine/Sql.php';
             $q = Sitengine_Sql::getLockQuery($tables);
             $this->getDatabase()->getConnection()->exec($q);
             */
             foreach ($rows as $id => $data) {
                 $affectedRows = $modifier->updateFromList($id, $data, $this->_authorizedGroups);
                 if ($affectedRows > 0) {
                     $updated++;
                 } else {
                     $this->_markedRows[$id] = 1;
                 }
             }
             #$this->getDatabase()->getConnection()->exec('UNLOCK TABLES');
             if ($updated < sizeof($rows)) {
                 $this->getStatus()->set(Sitengine_Env::STATUS_ERRORBATCHUPDATE, $this->getTranslate()->translate(Sitengine_Env::STATUS_ERRORBATCHUPDATE), true);
             } else {
                 if (sizeof($rows) > 0) {
                     $this->getStatus()->set(Sitengine_Env::STATUS_OKBATCHUPDATE, $this->getTranslate()->translate(Sitengine_Env::STATUS_OKBATCHUPDATE), false);
                 }
             }
         }
         return $this->_goToAction(self::ACTION_INDEX);
     } catch (Exception $exception) {
         throw $this->_prepareErrorHandler($exception);
     }
 }
Пример #15
0
 public function getFilterInstance(Sitengine_Controller_Request_Http $request, array $params, Zend_Session_Namespace $namespace)
 {
     $transcripts = $this->getTranscripts();
     $transcripts->setLanguage($this->_transcript);
     $index = $transcripts->getIndex();
     $default = $transcripts->getDefaultIndex();
     require_once 'Sitengine/Grid/Search.php';
     $filter = new Sitengine_Grid_Search();
     $reset = $request->get($params['reset']);
     ### filter element ###
     if ($reset) {
         $filter->resetSessionVal($params['find'], $namespace);
     }
     $filter->registerSessionVal($namespace, $request, $params['find'], self::VALUE_NONESELECTED);
     # set clause
     if ($filter->getVal($params['find'])) {
         $value = $this->getAdapter()->quote($filter->getVal($params['find']));
         $value = preg_replace('/\\s+/', ' ', $value);
         $value = preg_replace('/.(.*)./', "\$1", trim($value));
         # remove quote delimiters
         $clause = "(";
         $clause .= "LOWER({$this->_name}.titleLang{$index}) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$this->_name}.slug) LIKE LOWER('%{$value}%')";
         $clause .= ")";
         $filter->setClause($params['find'], $clause);
     }
     return $filter;
 }
Пример #16
0
 protected function _getMainSection()
 {
     try {
         $elements = array();
         $input = $this->_controller->getRequest()->getPost(null);
         #$valueSort = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT);
         #$valueOrder = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER);
         #$valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getNewsletterPackage()->getAttachmentsTable();
         ########################################################################
         #### FILTER INPUT
         ########################################################################
         $fieldsNormal = array('id' => '', 'mdate' => '', 'title' => '');
         $fieldsOnOff = array();
         if ($this->_inputMode == Sitengine_Env::INPUTMODE_UPDATE) {
             $stored = $this->_controller->getFrontController()->getNewsletterPackage()->getAttachmentsTable()->complementRow($this->_controller->getEntity()->getRow());
             $data = Sitengine_Controller_Request_Http::filterUpdateDeprecated(sizeof($input), $input, $fieldsNormal, $fieldsOnOff, $stored);
             $data = array_merge($stored, $data);
             # set dates to timezone
             /*
             $name = 'cdate';
             $date = new Zend_Date($stored[$name], Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             $data[$name]  = $date->get(Zend_Date::DATE_FULL).' ';
             $data[$name] .= $date->get(Zend_Date::TIME_FULL);
             */
             /*
             $name = 'mdate';
             $date = new Zend_Date($stored[$name], Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             $data[$name]  = $date->get(Zend_Date::DATE_LONG).' ';
             $data[$name] .= $date->get(Zend_Date::TIME_LONG);
             */
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS_SHARP);
             $uri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $queryUpdate = $uri;
             $childActions = array();
             $hiddens = array(Sitengine_Env::PARAM_METHOD => Sitengine_Env::METHOD_PUT, Sitengine_Env::PARAM_MDATE => $stored['mdate']);
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS_SHARP);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $stored['title'];
         } else {
             $data = Sitengine_Controller_Request_Http::filterInsertDeprecated(sizeof($input), $input, $fieldsNormal, $fieldsOnOff);
             $hiddens = array();
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS_NEW);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $this->_controller->getTranslate()->translate('formViewInsertTitle');
         }
         #Sitengine_Debug::print_r($data);
         ########################################################################
         #### ELEMENTS
         ########################################################################
         $n = 'title';
         $e = new Sitengine_Form_Element($n, $data[$n]);
         $e->setClass('viewFormInput');
         $e->setId('viewForm' . $n);
         $elements[$n] = $e->getText(40);
         $n = 'file1Original';
         $e = new Sitengine_Form_Element($n);
         $e->setClass('viewFormFile');
         $e->setId('viewForm' . $n);
         $elements[$n] = $e->getFile(40);
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('queryUpdate' => isset($queryUpdate) ? $queryUpdate : '', 'title' => $title, 'inputMode' => $this->_inputMode, 'hiddens' => implode('', $hiddens), 'submitUri' => $submitUri, 'ELEMENTS' => $elements, 'DATA' => $data);
     } catch (Exception $exception) {
         require_once 'Sitengine/Newsletter/Backend/Campaigns/Attachments/Exception.php';
         throw new Sitengine_Newsletter_Backend_Campaigns_Attachments_Exception('form page error', $exception);
     }
 }
Пример #17
0
 protected function _getMainSection()
 {
     try {
         require_once 'Sitengine/Form/Element.php';
         $valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getProtoPackage()->getGoodiesTable();
         $table->setTranscript($this->_controller->getPreferences()->getTranscript());
         $sorting = $table->getSortingInstance($this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT), $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER));
         ########################################################################
         #### SETTINGS
         ########################################################################
         $settingsIsActive = false;
         ### transcript ###
         $transcripts = $table->getTranscripts();
         $transcripts->setLanguage($this->_controller->getPreferences()->getTranscript());
         if (!$transcripts->isDefault()) {
             $settingsIsActive = true;
         }
         $languages = array();
         foreach ($transcripts->get() as $symbol) {
             $languages[$symbol] = $this->_controller->getTranslate()->translate('languages' . ucfirst($symbol));
         }
         ### ipp ###
         $defaultIpp = 20;
         $valueIpp = $this->_controller->getPreferences()->getItemsPerPage();
         $valueIpp = is_numeric($valueIpp) ? $valueIpp : $defaultIpp;
         $valueIpp = $valueIpp <= 100 && $valueIpp >= 1 ? $valueIpp : $defaultIpp;
         $ippValues = array('' => $this->_controller->getTranslate()->translate('indexViewSettingsSectionItemsPerPage'), 5 => 5, 10 => 10, 20 => 20, 50 => 50, 100 => 100);
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $settingsData = array('isActive' => $settingsIsActive, 'hiddens' => implode('', $hiddens), 'TRANSCRIPTS' => $languages, 'IPPS' => $ippValues, Sitengine_Env::PARAM_TRANSCRIPT => $transcripts->getSymbol(), Sitengine_Env::PARAM_IPP => $valueIpp);
         ########################################################################
         #### FILTER
         ########################################################################
         $filter = $table->getFilterInstance($this->_controller->getRequest(), array('uid' => Sitengine_Proto_Backend_Goodies_Controller::PARAM_FILTER_BY_UID, 'gid' => Sitengine_Proto_Backend_Goodies_Controller::PARAM_FILTER_BY_GID, 'type' => Sitengine_Proto_Backend_Goodies_Controller::PARAM_FILTER_BY_TYPE, 'find' => Sitengine_Proto_Backend_Goodies_Controller::PARAM_FILTER_BY_FIND, 'reset' => Sitengine_Proto_Backend_Goodies_Controller::PARAM_FILTER_RESET), $this->_controller->getNamespace());
         $types = $this->_controller->getTranslate()->translateGroup('fieldValsFilterByType')->toArray();
         $users = $this->_controller->getPermiso()->getDirectory()->getAllUsers();
         $users = array_merge($this->_controller->getTranslate()->translateGroup('fieldValsFilterByUid')->toArray(), $users);
         $groups = $this->_controller->getPermiso()->getDirectory()->getAllGroups();
         $groups = array_merge($this->_controller->getTranslate()->translateGroup('fieldValsFilterByGid')->toArray(), $groups);
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Proto_Backend_Goodies_Controller::PARAM_FILTER_RESET => 1);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES);
         $uriReset = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
         $uriReset .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $filterData = array('isActive' => $filter->isActive(), 'uriReset' => $uriReset, 'hiddens' => implode('', $hiddens), 'DATA' => $filter->getData(), 'TYPES' => $types, 'USERS' => $users, 'GROUPS' => $groups);
         ########################################################################
         #### SORTING
         ########################################################################
         $queries = array();
         foreach ($sorting->getOrdering() as $field => $order) {
             $query = array(Sitengine_Env::PARAM_SORT => $field, Sitengine_Env::PARAM_ORDER => $order);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES);
             $queries[$field] = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
             $queries[$field] .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         }
         $sortingData = array('QUERIES' => $queries, 'COLUMNS' => $sorting->getColumns());
         ########################################################################
         #### PAGER
         ########################################################################
         require_once 'Sitengine/Grid/Pager.php';
         $pager = new Sitengine_Grid_Pager($valuePage, $valueIpp);
         ########################################################################
         #### LISTQUERY
         ########################################################################
         $name = $this->_controller->getFrontController()->getProtoPackage()->getGoodiesTableName();
         $whereClauses = array($this->_controller->getPermiso()->getDac()->getReadAccessSql($this->_controller->getFrontController()->getProtoPackage()->getAuthorizedGroups(), $name, false), $filter->getSql(''));
         $select = $table->select()->order($sorting->getClause())->limit($valueIpp, $pager->getOffset());
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         $items = $table->fetchAll($select);
         # if current page is out of bounds - go to beginning of list
         if (!$items->count() && $pager->getCurrPage() > 1) {
             $pager = new Sitengine_Grid_Pager(1, $valueIpp);
             $select = $table->select()->order($sorting->getClause())->limit($valueIpp, 0);
             foreach ($whereClauses as $clause) {
                 if ($clause) {
                     $select->where($clause);
                 }
             }
             $items = $table->fetchAll($select);
         }
         # count total number of records
         $select = $table->select()->from($table, array('COUNT(*) AS count'));
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         $count = $table->fetchRow($select);
         $pager->calculate($count->count);
         ########################################################################
         #### LISTDATA
         ########################################################################
         $markedRows = $this->_controller->getMarkedRows();
         $list = array();
         foreach ($items as $item) {
             $row = $table->complementRow($item);
             #Sitengine_Debug::print_r($row);
             # row selector checkbox
             $row['rowSelectCheckbox'] = array();
             if (!$row['locked']) {
                 $name = 'SELECTROWITEM' . $row['id'];
                 $row['rowSelectCheckbox'] = array('name' => $name, 'checked' => sizeof($markedRows) && isset($markedRows[$row['id']]) ? $this->_controller->getRequest()->getPost($name) : 0);
             }
             $n = 'sorting';
             $name = 'UPDATEROWITEM' . $n . 'ITEMID' . $row['id'];
             $current = 'UPDATEROWITEMCURRENT' . $n . 'ITEMID' . $row['id'];
             $row['sortingText'] = array('name' => $name, 'value' => sizeof($markedRows) && isset($markedRows[$row['id']]) ? $this->_controller->getRequest()->getPost($name) : $row[$n], 'current' => Sitengine_Form_Element::getHidden($current, $row[$n]));
             $n = 'displayThis';
             $name = 'UPDATEROWITEM' . $n . 'ITEMID' . $row['id'];
             $current = 'UPDATEROWITEMCURRENT' . $n . 'ITEMID' . $row['id'];
             $row['displayThisSelect'] = array('name' => $name, 'value' => sizeof($markedRows) && isset($markedRows[$row['id']]) ? $this->_controller->getRequest()->getPost($name) : $row[$n], 'OPTIONS' => $this->_controller->getTranslate()->translateGroup('fieldValsDisplayThis')->toArray(), 'current' => Sitengine_Form_Element::getHidden($current, $row[$n]));
             $n = 'locked';
             $name = 'UPDATEROWITEM' . $n . 'ITEMID' . $row['id'];
             $current = 'UPDATEROWITEMCURRENT' . $n . 'ITEMID' . $row['id'];
             $row['lockedCheckbox'] = array('name' => $name, 'checked' => sizeof($markedRows) && isset($markedRows[$row['id']]) ? $this->_controller->getRequest()->getPost($name) : $row[$n], 'current' => Sitengine_Form_Element::getHidden($current, $row[$n]));
             $n = 'publish';
             $name = 'UPDATEROWITEM' . $n . 'ITEMID' . $row['id'];
             $current = 'UPDATEROWITEMCURRENT' . $n . 'ITEMID' . $row['id'];
             $row['publishCheckbox'] = array('name' => $name, 'checked' => sizeof($markedRows) && isset($markedRows[$row['id']]) ? $this->_controller->getRequest()->getPost($name) : $row[$n], 'current' => Sitengine_Form_Element::getHidden($current, $row[$n]));
             # uris
             $args = array(Sitengine_Env::PARAM_ID => $row['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHARP);
             $row['uriUpdate'] = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $row['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES);
             $row['uriShouldyIndex'] = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $row['isMarked'] = isset($markedRows[$row['id']]) ? $markedRows[$row['id']] : 0;
             $row['shouldyCount'] = $this->_controller->getViewHelper()->countShouldies($row['id']);
             $list[] = $row;
         }
         ########################################################################
         #### PAGER DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getPrevPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES);
         $uriPrevPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
         $uriPrevPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getNextPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES);
         $uriNextPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
         $uriNextPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $pagerData = array('hiddens' => implode('', $hiddens), 'currPage' => $pager->getCurrPage(), 'nextPage' => $pager->getNextPage(), 'prevPage' => $pager->getPrevPage(), 'numPages' => $pager->getNumPages(), 'numItems' => $pager->getNumItems(), 'firstItem' => $pager->getFirstItem(), 'lastItem' => $pager->getLastItem(), 'uriPrevPage' => $uriPrevPage, 'uriNextPage' => $uriNextPage);
         ########################################################################
         #### URIS
         ########################################################################
         $args = array();
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_BATCH);
         $uriDoBatchDelete = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $args = array();
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_BATCH);
         $uriDoBatchUpdate = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uris = array('submitDoBatchDelete' => $uriDoBatchDelete, 'submitDoBatchUpdate' => $uriDoBatchUpdate);
         ########################################################################
         #### METHODS
         ########################################################################
         $methods = array('doBatchDelete' => Sitengine_Env::METHOD_DELETE, 'doBatchUpdate' => Sitengine_Env::METHOD_PUT);
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_METHOD => '', Sitengine_Env::PARAM_PAGE => $valuePage, Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('hiddens' => implode('', $hiddens), 'title' => $this->_controller->getTranslate()->translate('indexViewTitle'), 'URIS' => $uris, 'METHODS' => $methods, 'FILTER' => $filterData, 'SETTINGS' => $settingsData, 'SORTING' => $sortingData, 'DATA' => $list, 'PAGER' => $pagerData);
     } catch (Exception $exception) {
         require_once 'Sitengine/Proto/Backend/Goodies/Exception.php';
         throw new Sitengine_Proto_Backend_Goodies_Exception('list page error', $exception);
     }
 }
Пример #18
0
 public function build()
 {
     try {
         $this->_settings['editorSnippet'] = $this->_controller->getEditorSnippet();
         $this->_queries = $this->_controller->getFrontController()->getQueries();
         $this->setSection('GLOBALNAV', $this->_controller->getFrontController()->getGlobalNavSection($this->_controller->getTranslate(), $this->_queries, 'blogBackendBlogs'));
         /*
         if($this->_controller->getEnv()->getDebugControl()) {
         	require_once 'Sitengine/Debug/Sections.php';
         	$this->setSection(
         		'DBG',
         		Sitengine_Debug_Sections::getForm(
         			$this->_controller->getRequest(),
         			$this->_controller->getPreferences()->getDebugMode(),
         			array('queries' => 'Queries', 'templateData' => 'Template Data'),
         			'dbg'
         		)
         	);
         }
         
         require_once 'Sitengine/Env/Preferences/Sections.php';
         
         if(sizeof($this->_controller->getTranslate()->getAvailableLanguages()) > 1) {
         	$this->setSection(
         		'LANGUAGE',
         		Sitengine_Env_Preferences_Sections::getLanguageForm(
         			$this->_controller->getPreferences()->getLanguage(),
         			$this->_controller->getTranslate()->getAvailableLanguages(),
         			$this->_controller->getTranslate()->translateGroup('loclangs')->toArray(),
         			'language'
         		)
         	);
         }
         
         $this->setSection(
         	'TIMEZONE',
         	Sitengine_Env_Preferences_Sections::getTimezoneForm(
         		$this->_controller->getPreferences()->getTimezone(),
         		$this->_controller->getEnv()->getTimezones(),
         		'timezone'
         	)
         );
         */
         $breadcrumbs = $this->_makeBreadcrumbsData();
         $blogSlug = $this->_controller->getFrontController()->getBlogPackage()->getBlogSlug();
         if ($blogSlug === null) {
             $this->setSection('BREADCRUMBS', array('DATA' => $breadcrumbs));
         }
         $this->setSection('ABSTRACT', array('title' => $breadcrumbs['blog']['title'], 'uri' => $blogSlug ? $breadcrumbs['blog']['uriUpdate'] : '', 'help' => ''));
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorSlug());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS);
         $uriIndex = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         /*
         $args = array(
         	Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorSlug()
         );
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS);
         $uriInsert = $this->_controller->getRequest()->getBasePath().'/'.$route->assemble($args, true);
         */
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorSlug());
         $query = array(Sitengine_Blog::PARAM_TYPE => Sitengine_Blog_Posts_Table::TYPE_TEXT);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_NEW);
         $uriTextInsert = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriTextInsert .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorSlug());
         $query = array(Sitengine_Blog::PARAM_TYPE => Sitengine_Blog_Posts_Table::TYPE_PHOTO);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_NEW);
         $uriPhotoInsert = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriPhotoInsert .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorSlug());
         $query = array(Sitengine_Blog::PARAM_TYPE => Sitengine_Blog_Posts_Table::TYPE_GALLERY);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_NEW);
         $uriGalleryInsert = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriGalleryInsert .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorSlug());
         $query = array(Sitengine_Blog::PARAM_TYPE => Sitengine_Blog_Posts_Table::TYPE_QUOTE);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_NEW);
         $uriQuoteInsert = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriQuoteInsert .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorSlug());
         $query = array(Sitengine_Blog::PARAM_TYPE => Sitengine_Blog_Posts_Table::TYPE_LINK);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_NEW);
         $uriLinkInsert = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriLinkInsert .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorSlug());
         $query = array(Sitengine_Blog::PARAM_TYPE => Sitengine_Blog_Posts_Table::TYPE_AUDIO);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_NEW);
         $uriAudioInsert = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriAudioInsert .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorSlug());
         $query = array(Sitengine_Blog::PARAM_TYPE => Sitengine_Blog_Posts_Table::TYPE_VIDEO);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_NEW);
         $uriVideoInsert = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriVideoInsert .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $this->setSection('ACTIONS', array(array('uri' => $uriIndex, 'label' => $this->_controller->getTranslate()->translate('labelsActionsSectionIndex')), array('uri' => $uriTextInsert, 'label' => $this->_controller->getTranslate()->translate('labelsActionsSectionInsertText')), array('uri' => $uriGalleryInsert, 'label' => $this->_controller->getTranslate()->translate('labelsActionsSectionInsertGallery')), array('uri' => $uriPhotoInsert, 'label' => $this->_controller->getTranslate()->translate('labelsActionsSectionInsertPhoto')), array('uri' => $uriAudioInsert, 'label' => $this->_controller->getTranslate()->translate('labelsActionsSectionInsertAudio')), array('uri' => $uriVideoInsert, 'label' => $this->_controller->getTranslate()->translate('labelsActionsSectionInsertVideo')), array('uri' => $uriQuoteInsert, 'label' => $this->_controller->getTranslate()->translate('labelsActionsSectionInsertQuote')), array('uri' => $uriLinkInsert, 'label' => $this->_controller->getTranslate()->translate('labelsActionsSectionInsertLink'))));
         return $this;
     } catch (Exception $exception) {
         require_once 'Sitengine/Blog/Backend/Blogs/Posts/Exception.php';
         throw new Sitengine_Blog_Backend_Blogs_Posts_Exception('build page error', $exception);
     }
 }
Пример #19
0
 protected function _getMainSection()
 {
     try {
         $elements = array();
         $input = $this->_controller->getRequest()->getPost(null);
         #$valueSort = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT);
         #$valueOrder = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER);
         #$valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         ########################################################################
         #### FILTER INPUT
         ########################################################################
         $fieldsNormal = array('id' => '', 'keyword' => '');
         $fieldsOnOff = array('locked' => 0);
         if ($this->_inputMode == Sitengine_Env::INPUTMODE_UPDATE) {
             require_once 'Sitengine/Form/Payloads.php';
             $payloads = new Sitengine_Form_Payloads();
             $payloads->start($this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAYLOAD_NAME));
             $stored = $this->_controller->getEntity()->getData();
             $data = Sitengine_Controller_Request_Http::filterUpdateDeprecated(sizeof($input), $input, $fieldsNormal, $fieldsOnOff, $stored);
             $data = array_merge($stored, $data);
             # set dates to timezone
             /*
             $name = 'cdate';
             $date = new Zend_Date($stored[$name], Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             $data[$name]  = $date->get(Zend_Date::DATE_FULL).' ';
             $data[$name] .= $date->get(Zend_Date::TIME_FULL);
             */
             /*
             $name = 'mdate';
             $date = new Zend_Date($stored[$name], Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             $data[$name]  = $date->get(Zend_Date::DATE_LONG).' ';
             $data[$name] .= $date->get(Zend_Date::TIME_LONG);
             */
             $hiddens = array(Sitengine_Env::PARAM_PAYLOAD_NAME => $payloads->getName(), Sitengine_Env::PARAM_MDATE => $stored['mdate']);
             $args = array(Sitengine_Env::PARAM_ID => $stored['id'], Sitengine_Env::PARAM_ACTION => Sitengine_Sitemap_Backend_Controller::ACTION_DOUPDATELAYER);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Sitemap_Backend_Front::ROUTE_INDEX);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $this->_controller->getTranslate()->translate('labelsViewformUpdateLayerTitle');
         } else {
             require_once 'Sitengine/Form/Payloads.php';
             $payloads = new Sitengine_Form_Payloads();
             $payloads->start();
             $data = Sitengine_Controller_Request_Http::filterInsertDeprecated(sizeof($input), $input, $fieldsNormal, $fieldsOnOff);
             $gid = $this->_controller->getPermiso()->getDirectory()->getGroupId($this->_controller->getOwnerGroup());
             $data[Sitengine_Permiso::FIELD_GID] = !is_null($gid) ? $gid : Sitengine_Permiso::GID_ADMINISTRATORS;
             $data[Sitengine_Permiso::FIELD_UID] = $this->_controller->getPermiso()->getAuth()->getId();
             $hiddens = array(Sitengine_Env::PARAM_PAYLOAD_NAME => $payloads->getName());
             $args = array(Sitengine_Env::PARAM_PARENTID => $this->_controller->getEntity()->getParentId(), Sitengine_Env::PARAM_ACTION => Sitengine_Sitemap_Backend_Controller::ACTION_DONEWLAYER);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Sitemap_Backend_Front::ROUTE_INDEX);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $this->_controller->getTranslate()->translate('labelsViewformNewLayerTitle');
         }
         #Sitengine_Debug::print_r($data);
         ########################################################################
         #### ELEMENTS
         ########################################################################
         if ($payloads->isMain()) {
             /*
             if(
             	(!$data['id']) || # on insert
             	(isset($data[Sitengine_Permiso::FIELD_UID]) && $data[Sitengine_Permiso::FIELD_UID]==$this->_controller->getPermiso()->getAuth()->getId()) || # owners ok
             	#$this->_controller->getPermiso()->getUser()->hasSupervisorRights() || # supervisors ok
             	#$this->_controller->getPermiso()->getUser()->hasModeratorRights() # moderators ok
             	$this->_controller->getPermiso()->getDirectory()->userIsMember($this->_controller->getPermiso()->getAuth()->getId(), Sitengine_Permiso::GID_ADMINISTRATORS)
             )
             {
             	$n = Sitengine_Permiso::FIELD_UID;
             	$e = new Sitengine_Form_Element($n, $data[$n]);
             	$e->setClass('viewFormSelect');
             	$e->setId('viewForm'.$n);
             	$users = $this->_controller->getPermiso()->getDirectory()->getAllUsers();
             	$elements[$n] = $e->getSelect($users);
             	
             	$n = Sitengine_Permiso::FIELD_GID;
             	$e = new Sitengine_Form_Element($n, $data[$n]);
             	$e->setClass('viewFormSelect');
             	$e->setId('viewForm'.$n);
             	$groups = $this->_controller->getPermiso()->getDirectory()->getAllGroups();
             	$groups = array_merge($this->_controller->getTranslate()->translateGroup('fieldValsGid')->toArray(), $groups);
             	$elements[$n] = $e->getSelect($groups);
             	
             	$n = Sitengine_Permiso::FIELD_RAG;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_RAW;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_UAG;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_UAW;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_DAG;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_DAW;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             }
             */
             $n = 'locked';
             $e = new Sitengine_Form_Element($n, '1');
             $e->setClass('viewFormCheckbox');
             $e->setId('viewForm' . $n);
             $elements[$n] = $e->getCheckbox($data[$n]);
             $n = 'keyword';
             $e = new Sitengine_Form_Element($n, $data[$n]);
             $e->setClass('viewFormInput');
             $e->setId('viewForm' . $n);
             $elements[$n] = $e->getText(40);
         }
         ########################################################################
         #### PAYLOAD NAV DATA
         ########################################################################
         $payloadNav = array();
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('payloadName' => $payloads->getName(), 'payloadIsMain' => $payloads->isMain(), 'queryUpdate' => isset($queryUpdate) ? $queryUpdate : '', 'title' => $title, 'inputMode' => $this->_inputMode, 'hiddens' => implode('', $hiddens), 'submitUri' => $submitUri, 'ELEMENTS' => $elements, 'PAYLOADNAV' => $payloadNav, 'DATA' => $data);
     } catch (Exception $exception) {
         require_once 'Sitengine/Sitemap/Backend/Exception.php';
         throw new Sitengine_Sitemap_Backend_Exception('form page error', $exception);
     }
 }
Пример #20
0
 protected function _getMainSection()
 {
     try {
         $valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getBlogPackage()->getBlogsTable();
         $table->setTranscript($this->_controller->getPreferences()->getTranscript());
         $filter = $table->getFilterInstance($this->_controller->getRequest(), array('find' => Sitengine_Blog_Frontend_Blogs_Controller::PARAM_FILTER_BY_FIND, 'reset' => Sitengine_Blog_Frontend_Blogs_Controller::PARAM_FILTER_RESET), $this->_controller->getNamespace());
         $sorting = $table->getSortingInstance($this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT), $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER));
         ########################################################################
         #### SETTINGS
         ########################################################################
         $settingsIsActive = false;
         $settingsElements = array();
         /*
         ### transcript element ###
         $transcripts = $table->getTranscripts();
         $transcripts->setLanguage($this->_controller->getPreferences()->getLanguage());
         if(!$transcripts->isDefault()) { $settingsIsActive = true; }
         # set html input element
         $languages = array();
         foreach($transcripts->get() as $symbol) {
         	$languages[$symbol] = $this->_controller->getTranslate()->translate('languages'.ucfirst($symbol));
         }
         $e = new Sitengine_Form_Element(Sitengine_Env::PARAM_TRANSCRIPT, $transcripts->getSymbol());
         $e->setId('settings'.Sitengine_Env::PARAM_TRANSCRIPT);
         $e->setClass('settingsSelect');
         $settingsElements[Sitengine_Env::PARAM_TRANSCRIPT] = $e->getSelect($languages);
         */
         ### ipp element ###
         $defaultIpp = 20;
         $valueIpp = $this->_controller->getPreferences()->getItemsPerPage();
         $valueIpp = is_numeric($valueIpp) ? $valueIpp : $defaultIpp;
         $valueIpp = $valueIpp <= 100 && $valueIpp >= 1 ? $valueIpp : $defaultIpp;
         # set html input element
         $ippValues = array('' => $this->_controller->getTranslate()->translate('labelsSettingsSectionItemsPerPage'), 5 => 5, 10 => 10, 20 => 20, 50 => 50, 100 => 100);
         $e = new Sitengine_Form_Element(Sitengine_Env::PARAM_IPP, $valueIpp);
         $e->setId('settings' . Sitengine_Env::PARAM_IPP);
         $e->setClass('settingsSelect');
         $settingsElements[Sitengine_Env::PARAM_IPP] = $e->getSelect($ippValues);
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $settingsData = array('isActive' => $settingsIsActive, 'hiddens' => implode('', $hiddens), 'ELEMENTS' => $settingsElements);
         ########################################################################
         #### FILTER
         ########################################################################
         $e = new Sitengine_Form_Element(Sitengine_Blog_Frontend_Blogs_Controller::PARAM_FILTER_BY_FIND, $filter->getVal(Sitengine_Blog_Frontend_Blogs_Controller::PARAM_FILTER_BY_FIND));
         $e->setId('filter' . Sitengine_Blog_Frontend_Blogs_Controller::PARAM_FILTER_BY_FIND);
         $e->setClass('filterText');
         $filter->setElement(Sitengine_Blog_Frontend_Blogs_Controller::PARAM_FILTER_BY_FIND, $e->getText(20));
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Blog_Frontend_Blogs_Controller::PARAM_FILTER_RESET => 1);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Frontend_Front::ROUTE_BLOGS);
         $uriReset = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
         $uriReset .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $filterData = array('isActive' => $filter->isActive(), 'uriReset' => $uriReset, 'hiddens' => implode('', $hiddens), 'ELEMENTS' => $filter->getElements(), 'DATA' => $filter->getData());
         ########################################################################
         #### SORTING
         ########################################################################
         $queries = array();
         foreach ($sorting->getOrdering() as $field => $order) {
             $query = array(Sitengine_Env::PARAM_SORT => $field, Sitengine_Env::PARAM_ORDER => $order);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Frontend_Front::ROUTE_BLOGS);
             $queries[$field] = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
             $queries[$field] .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         }
         $sortingData = array('QUERIES' => $queries, 'COLUMNS' => $sorting->getColumns());
         ########################################################################
         #### PAGER
         ########################################################################
         $pager = new Sitengine_Grid_Pager($valuePage, $valueIpp);
         ########################################################################
         #### LISTQUERY
         ########################################################################
         $name = $this->_controller->getFrontController()->getBlogPackage()->getBlogsTableName();
         $whereClauses = array("{$table}.publish = '1'", $filter->getSql(''));
         $select = $table->select()->order($sorting->getClause())->limit($valueIpp, $pager->getOffset());
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         $items = $table->fetchAll($select);
         # if current page is out of bounds - go to beginning of list
         if (!$items->count() && $pager->getCurrPage() > 1) {
             $pager = new Sitengine_Grid_Pager(1, $valueIpp);
             $select = $table->select()->order($sorting->getClause())->limit($valueIpp, 0);
             foreach ($whereClauses as $clause) {
                 if ($clause) {
                     $select->where($clause);
                 }
             }
             $items = $table->fetchAll($select);
         }
         # count total number of records
         $select = $table->select()->from($table, array('COUNT(*) AS count'));
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         $count = $table->fetchRow($select);
         $pager->calculate($count->count);
         ########################################################################
         #### LISTDATA
         ########################################################################
         #$markedRows = $this->_controller->getMarkedRows();
         $list = array();
         foreach ($items as $item) {
             $row = $table->complementRow($item);
             /*
             # row selector checkbox
             				$p = 'SELECTROWITEM'.$row['id'];
             				$s = (sizeof($markedRows) && isset($markedRows[$row['id']])) ? $this->_controller->getRequest()->getPost($p) : 0;
             				$e = new Sitengine_Form_Element($p, 1);
             				$e->setClass('listformCheckbox');
             				$row['rowSelectCheckbox'] = $e->getCheckbox($s);
             
             $n = 'publish';
             $p = 'UPDATEROWITEM'.$n.'ITEMID'.$row['id'];
             $h = 'UPDATEROWITEMCURRENT'.$n.'ITEMID'.$row['id'];
             $s = (sizeof($markedRows) && isset($markedRows[$row['id']])) ? $this->_controller->getRequest()->getPost($p) : $row[$n];
             $e = new Sitengine_Form_Element($p, 1);
             $e->setClass('listformCheckbox');
             $publish  = $e->getCheckbox($s);
             $publish .= Sitengine_Form_Element::getHidden($h, $row[$n]);
             
             # uris
             $uriUpdate = $this->_makeUpdateUri($row);
             */
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $row['slug']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Frontend_Front::ROUTE_BLOGS_POSTS);
             $uriPostIndex = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             /*
             $args = array(
                 Sitengine_Env::PARAM_ANCESTORID => $row['id']
             );
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Frontend_Front::ROUTE_BLOGS_POSTS_NEW);
             $uriPostInsert = $this->_controller->getRequest()->getBasePath().'/'.$route->assemble($args, true);
             
             
             $row['isMarked'] = (isset($markedRows[$row['id']])) ? $markedRows[$row['id']] : 0;
             $row['publishCheckbox'] = $publish;
             */
             $row['postCount'] = $this->_controller->getViewHelper()->countPosts($row['id']);
             $row['uriPostIndex'] = $uriPostIndex;
             #$row['uriPostInsert'] = $uriPostInsert;
             #$row['uriUpdate'] = $uriUpdate;
             #$row['cdate'] = $this->_controller->getViewHelper()->formatDate($row['cdate']);
             #$row['mdate'] = $this->_controller->getViewHelper()->formatDate($row['mdate']);
             $list[] = $row;
         }
         ########################################################################
         #### PAGER DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getPrevPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Frontend_Front::ROUTE_BLOGS);
         $uriPrevPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
         $uriPrevPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getNextPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Frontend_Front::ROUTE_BLOGS);
         $uriNextPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
         $uriNextPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $currPageInput = new Sitengine_Form_Element(Sitengine_Env::PARAM_PAGE, $pager->getCurrPage());
         $currPageInput->setClass('pagerInput');
         $pagerData = array('hiddens' => implode('', $hiddens), 'currPageInput' => $currPageInput->getText(2), 'currPage' => $pager->getCurrPage(), 'nextPage' => $pager->getNextPage(), 'prevPage' => $pager->getPrevPage(), 'numPages' => $pager->getNumPages(), 'numItems' => $pager->getNumItems(), 'firstItem' => $pager->getFirstItem(), 'lastItem' => $pager->getLastItem(), 'uriPrevPage' => $uriPrevPage, 'uriNextPage' => $uriNextPage);
         /*
         ########################################################################
         #### URIS
         ########################################################################
         $args = array();
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Frontend_Front::ROUTE_BLOGS_BATCH);
         $uriDoBatchDelete = $this->_controller->getRequest()->getBasePath().'/'.$route->assemble($args, true);
         
         $args = array();
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Frontend_Front::ROUTE_BLOGS_BATCH);
         $uriDoBatchUpdate = $this->_controller->getRequest()->getBasePath().'/'.$route->assemble($args, true);
         
         $uris = array(
         	'submitDoBatchDelete' => $uriDoBatchDelete,
         	'submitDoBatchUpdate' => $uriDoBatchUpdate
         );
         
         
         
         ########################################################################
         #### METHODS
         ########################################################################
         $methods = array(
         	'doBatchDelete' => Sitengine_Env::METHOD_DELETE,
         	'doBatchUpdate' => Sitengine_Env::METHOD_PUT
         );
         
         
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         $hiddens = array(
             Sitengine_Env::PARAM_METHOD => '',
             Sitengine_Env::PARAM_PAGE => $valuePage,
             Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(),
             Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder()
         );
         foreach($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         */
         return array('FILTER' => $filterData, 'SETTINGS' => $settingsData, 'SORTING' => $sortingData, 'DATA' => $list, 'PAGER' => $pagerData);
     } catch (Exception $exception) {
         require_once 'Sitengine/Blog/Frontend/Blogs/Exception.php';
         throw new Sitengine_Blog_Frontend_Blogs_Exception('list page error', $exception);
     }
 }
Пример #21
0
 protected function _getMainSection()
 {
     try {
         $elements = array();
         $input = $this->_controller->getRequest()->getPost(null);
         #$valueSort = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT);
         #$valueOrder = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER);
         #$valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getPermiso()->getUsersTable();
         ########################################################################
         #### FILTER INPUT
         ########################################################################
         $fields = array('id' => '', 'mdate' => '', 'locked' => '', 'enabled' => 1, 'language' => '', 'timezone' => 'UTC', 'name' => '', 'nickname' => '', 'firstname' => '', 'lastname' => '', 'country' => '', 'description' => '', 'password' => '', 'newsletter' => 1);
         if ($this->_inputMode == Sitengine_Env::INPUTMODE_UPDATE) {
             $stored = $this->_controller->getFrontController()->getPermiso()->getUsersTable()->complementRow($this->_controller->getEntity()->getRow());
             $data = Sitengine_Controller_Request_Http::filterUpdate(sizeof($input), $input, $fields, $stored);
             $data = array_merge($stored, $data);
             $args = array(Sitengine_Env::PARAM_ID => $stored['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_USERS_SHARP);
             $uri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $queryUpdate = $uri;
             $childActions = array();
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $stored['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_USERS_MEMBERSHIPS);
             $uri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $childActions['membershipsIndex'] = array('uri' => $uri, 'label' => $this->_controller->getTranslate()->translate('formViewChildActionsSectionMembershipsIndex'), 'postfix' => ' (' . $this->_controller->getViewHelper()->countMemberships($stored['id']) . ')');
             $hiddens = array(Sitengine_Env::PARAM_METHOD => Sitengine_Env::METHOD_PUT, Sitengine_Env::PARAM_MDATE => $stored['mdate']);
             $args = array(Sitengine_Env::PARAM_ID => $stored['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_USERS_SHARP);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $stored['name'] . ' (' . $stored['firstname'] . ' ' . $stored['lastname'] . ')';
         } else {
             $data = Sitengine_Controller_Request_Http::filterInsert(sizeof($input), $input, $fields);
             $hiddens = array();
             $args = array();
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_USERS_NEW);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $this->_controller->getTranslate()->translate('formViewInsertTitle');
             $displayPermissionSettings = true;
         }
         #Sitengine_Debug::print_r($data);
         $data['countryOptions'] = array_merge($this->_controller->getTranslate()->translateGroup('fieldValsCountry')->toArray(), $this->_controller->getTranslate()->translateGroup('countries')->toArray());
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('queryUpdate' => isset($queryUpdate) ? $queryUpdate : '', 'title' => $title, 'inputMode' => $this->_inputMode, 'hiddens' => implode('', $hiddens), 'submitUri' => $submitUri, 'ELEMENTS' => $elements, 'CHILDACTIONS' => isset($childActions) ? $childActions : array(), 'DATA' => $data);
     } catch (Exception $exception) {
         require_once 'Sitengine/Permiso/Backend/Users/Exception.php';
         throw new Sitengine_Permiso_Backend_Users_Exception('form page error', $exception);
     }
 }
Пример #22
0
 protected function _getMainSection()
 {
     try {
         $elements = array();
         $input = $this->_controller->getRequest()->getPost(null);
         #$valueSort = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT);
         #$valueOrder = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER);
         #$valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getProtoPackage()->getCouldiesTable();
         $table->setTranscript($this->_controller->getPreferences()->getTranscript());
         $transcripts = $table->getTranscripts();
         $displayPermissionSettings = false;
         ########################################################################
         #### FILTER INPUT
         ########################################################################
         $fields = array('id' => '', Sitengine_Permiso::FIELD_UID => '', Sitengine_Permiso::FIELD_GID => '', Sitengine_Permiso::FIELD_RAG => 1, Sitengine_Permiso::FIELD_RAW => 1, Sitengine_Permiso::FIELD_UAG => 1, Sitengine_Permiso::FIELD_UAW => 0, Sitengine_Permiso::FIELD_DAG => 1, Sitengine_Permiso::FIELD_DAW => 0, 'mdate' => '', 'type' => 'fan', 'sorting' => '', 'displayThis' => 1, 'publish' => 1, 'locked' => 0);
         foreach ($transcripts->get() as $index => $symbol) {
             $fields['titleLang' . $index] = '';
             $fields['textLang' . $index] = '';
         }
         if ($this->_inputMode == Sitengine_Env::INPUTMODE_UPDATE) {
             require_once 'Sitengine/Form/TranscriptsPayloads.php';
             $payloads = new Sitengine_Form_TranscriptsPayloads($transcripts);
             $payloads->start($this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAYLOAD_NAME));
             $stored = $this->_controller->getFrontController()->getProtoPackage()->getCouldiesTable()->complementRow($this->_controller->getEntity()->getRow());
             $data = Sitengine_Controller_Request_Http::filterUpdate(sizeof($input), $input, $fields, $stored);
             $data = array_merge($stored, $data);
             $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorId(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_COULDIES_SHARP);
             $uri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $queryUpdate = $uri;
             $hiddens = array(Sitengine_Env::PARAM_METHOD => Sitengine_Env::METHOD_PUT, Sitengine_Env::PARAM_PAYLOAD_NAME => $payloads->getName(), Sitengine_Env::PARAM_MDATE => $stored['mdate']);
             $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorId(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_COULDIES_SHARP);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $stored['titleLang' . $transcripts->getIndex()];
             $title = $title != '' ? $title : $stored['titleLang0'];
             if ($data[Sitengine_Permiso::FIELD_UID] == $this->_controller->getPermiso()->getAuth()->getId() || $this->_controller->getPermiso()->getDirectory()->userIsMember($this->_controller->getPermiso()->getAuth()->getId(), Sitengine_Permiso::GID_ADMINISTRATORS)) {
                 $displayPermissionSettings = true;
             }
         } else {
             require_once 'Sitengine/Form/TranscriptsPayloads.php';
             $payloads = new Sitengine_Form_TranscriptsPayloads($transcripts);
             $payloads->start();
             $data = Sitengine_Controller_Request_Http::filterInsert(sizeof($input), $input, $fields);
             $gid = $this->_controller->getPermiso()->getDirectory()->getGroupId($this->_controller->getFrontController()->getProtoPackage()->getOwnerGroup());
             $data[Sitengine_Permiso::FIELD_GID] = !is_null($gid) ? $gid : Sitengine_Permiso::GID_ADMINISTRATORS;
             $data[Sitengine_Permiso::FIELD_UID] = $this->_controller->getPermiso()->getAuth()->getId();
             # set some defaults...
             $n = 'sorting';
             if (array_key_exists($n, $input)) {
                 $data[$n] = $input[$n];
             } else {
                 $q = 'SELECT MAX(sorting) AS maxSorting FROM ' . $this->_controller->getFrontController()->getProtoPackage()->getCouldiesTableName();
                 $q .= ' WHERE ';
                 #.Sitengine_Permiso::FIELD_OID.' = "'.$this->_controller->getPermiso()->getOrganization()->getId().'"';
                 $q .= ' shouldyId = "' . $this->_controller->getEntity()->getAncestorId() . '"';
                 $statement = $this->_controller->getDatabase()->prepare($q);
                 $statement->execute();
                 $result = $statement->fetchAll();
                 $data[$n] = $result[0]['maxSorting'] + 10;
             }
             $n = 'titleLang0';
             if (array_key_exists($n, $input)) {
                 $data[$n] = $input[$n];
             } else {
                 $data[$n] = 'Couldy Record (Language 0/Default)';
             }
             $n = 'titleLang1';
             if (array_key_exists($n, $input)) {
                 $data[$n] = $input[$n];
             } else {
                 $data[$n] = 'Couldy Record (Language 1)';
             }
             $hiddens = array(Sitengine_Env::PARAM_PAYLOAD_NAME => $payloads->getName());
             $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorId(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_COULDIES_NEW);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $this->_controller->getTranslate()->translate('formViewInsertTitle');
             $displayPermissionSettings = true;
         }
         #Sitengine_Debug::print_r($data);
         $data['uidOptions'] = $this->_controller->getPermiso()->getDirectory()->getAllUsers();
         $data['gidOptions'] = array_merge($this->_controller->getTranslate()->translateGroup('fieldValsGid')->toArray(), $this->_controller->getPermiso()->getDirectory()->getAllGroups());
         ########################################################################
         #### CONTENT PAYLOAD SECTION TITLE
         ########################################################################
         $contentSectionTitle = $this->_controller->getTranslate()->translate('formViewContentSectionTitleDefault');
         if (sizeof($transcripts->get()) > 1) {
             if (!$payloads->isMain()) {
                 $symbol = $payloads->getTranscriptSymbol();
             } else {
                 $symbol = $transcripts->getDefaultSymbol();
             }
             $contentSectionTitle .= ' (' . $this->_controller->getTranslate()->translate('languages' . ucfirst($symbol)) . ')';
         }
         ########################################################################
         #### PAYLOAD NAV DATA
         ########################################################################
         $payloadNav = array();
         if ($this->_inputMode == Sitengine_Env::INPUTMODE_UPDATE) {
             $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorId(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
             $query = array(Sitengine_Env::PARAM_PAYLOAD_NAME => $payloads->getMainName());
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_COULDIES_SHARP);
             $uri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $uri .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
             $payloadNav[$payloads->getMainName()] = array('uri' => $uri, 'label' => $this->_controller->getTranslate()->translate('formViewPayloadNavTitleMain'));
             foreach ($transcripts->get() as $index => $symbol) {
                 $currentPayload = $payloads->getTranscriptNamePrefix() . '_' . $symbol;
                 $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorId(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $stored['id']);
                 $query = array(Sitengine_Env::PARAM_PAYLOAD_NAME => $currentPayload);
                 $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_COULDIES_SHARP);
                 $uri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
                 $uri .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
                 if (sizeof($transcripts->get()) > 1) {
                     $label = $this->_controller->getTranslate()->translate('languages' . ucfirst($symbol));
                 } else {
                     $label = $this->_controller->getTranslate()->translate('formViewContentSectionTitleDefault');
                 }
                 $payloadNav[$currentPayload] = array('uri' => $uri, 'label' => $label);
             }
         }
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('displayPermissionSettings' => $displayPermissionSettings, 'queryUpdate' => isset($queryUpdate) ? $queryUpdate : '', 'title' => $title, 'contentSectionTitle' => $contentSectionTitle, 'inputMode' => $this->_inputMode, 'hiddens' => implode('', $hiddens), 'submitUri' => $submitUri, 'ELEMENTS' => $elements, 'PAYLOADNAV' => $payloadNav, 'Payloads' => $payloads, 'DATA' => $data);
     } catch (Exception $exception) {
         require_once 'Sitengine/Proto/Backend/Goodies/Shouldies/Couldies/Exception.php';
         throw new Sitengine_Proto_Backend_Goodies_Shouldies_Couldies_Exception('form page error', $exception);
     }
 }
Пример #23
0
 protected function _getMainSection()
 {
     try {
         $list = array();
         $markedRows = $this->_controller->getMarkedRows();
         #Sitengine_Debug::print_r($markedRows);
         $dir = $this->_controller->getTempDir();
         if (is_dir($dir)) {
             $dirIterator = new DirectoryIterator($dir);
             $date = new Zend_Date(null, Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             foreach ($dirIterator as $count => $file) {
                 if (is_file($dir . '/' . $file->getFilename()) && !preg_match('/^(\\.|\\.\\.|\\.DS_Store)$/', $file->getFilename())) {
                     $filename = $file->getFilename();
                     $id = 'item' . $count;
                     $size = round($file->getSize() / 1024 / 1024, 1);
                     if ($size >= 1) {
                         $size .= 'MB';
                     } else {
                         $size = round($file->getSize() / 1024, 0) . 'KB';
                     }
                     $date->setTimestamp($file->getCTime());
                     $udate = $date->get(Zend_Date::DATE_FULL) . ' ';
                     $udate .= $date->get(Zend_Date::TIME_FULL);
                     $p = 'SELECTROWITEM' . $id;
                     $s = sizeof($markedRows) && isset($markedRows[$id]) ? $this->_controller->getRequest()->getPost($p) : 0;
                     $e = new Sitengine_Form_Element($p, 1);
                     $e->setClass('listformCheckbox');
                     $checkbox = $e->getCheckbox($s);
                     $checkbox .= Sitengine_Form_Element::getHidden('FILENAME' . $id, $filename);
                     $n = 'type';
                     $p = 'UPDATEROWITEM' . $n . 'ITEMID' . $id;
                     $h = 'UPDATEROWITEMCURRENT' . $n . 'ITEMID' . $id;
                     $v = sizeof($markedRows) && isset($markedRows[$id]) ? $this->_controller->getRequest()->getPost($p) : Sitengine_Proto_Backend_Goodies_Shouldies_Controller::VALUE_NONESELECTED;
                     $e = new Sitengine_Form_Element($p, $v);
                     $e->setClass('listformSelect');
                     $type = $e->getSelect($this->_controller->getTranslate()->translateGroup('fieldValsType')->toArray());
                     $type .= Sitengine_Form_Element::getHidden($h, Sitengine_Proto_Backend_Goodies_Shouldies_Controller::VALUE_NONESELECTED);
                     $args = array(Sitengine_Env::PARAM_CONTROLLER => 'shouldiesUploads', Sitengine_Env::PARAM_FILE => $filename);
                     $uriDownload = $this->_controller->getFrontController()->getProtoPackage()->getDownloadHandler();
                     $uriDownload .= Sitengine_Controller_Request_Http::makeNameValueQuery($args);
                     $list[] = array('id' => $id, 'name' => $filename, 'size' => $size, 'udate' => $udate, 'rowSelectCheckbox' => $checkbox, 'type' => $type, 'uriDownload' => $uriDownload, 'isMarked' => isset($markedRows[$id]) ? $markedRows[$id] : 0);
                 }
             }
         }
         #Sitengine_Debug::print_r($list);
         ########################################################################
         #### PAGER DATA
         #######################################################################
         $pagerData = array('hiddens' => '', 'currPageInput' => '', 'currPage' => 1, 'nextPage' => 1, 'prevPage' => 1, 'numPages' => 1, 'numItems' => sizeof($list), 'firstItem' => 1, 'lastItem' => sizeof($list), 'uriPrevPage' => '', 'uriNextPage' => '');
         ########################################################################
         #### URIS
         ########################################################################
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_UPLOAD);
         $uriDoBatchUnlink = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_ASSIGN);
         $uriDoBatchAssign = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uris = array('submitDoBatchAssign' => $uriDoBatchAssign, 'submitDoBatchUnlink' => $uriDoBatchUnlink);
         ########################################################################
         #### METHODS
         ########################################################################
         $methods = array('doBatchUnlink' => Sitengine_Env::METHOD_DELETE, 'doBatchAssign' => Sitengine_Env::METHOD_POST);
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_METHOD => '');
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('hiddens' => implode('', $hiddens), 'title' => $this->_controller->getTranslate()->translate('assignViewAssignFormTitle'), 'URIS' => $uris, 'METHODS' => $methods, 'DATA' => $list, 'PAGER' => $pagerData);
     } catch (Exception $exception) {
         require_once 'Sitengine/Proto/Backend/Goodies/Shouldies/Exception.php';
         throw new Sitengine_Proto_Backend_Goodies_Shouldies_Exception('list page error', $exception);
     }
 }
Пример #24
0
 protected function _getMainSection()
 {
     try {
         $valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getNewsletterPackage()->getAttachmentsTable();
         $filter = $table->getFilterInstance($this->_controller->getRequest(), array('find' => Sitengine_Newsletter_Backend_Campaigns_Attachments_Controller::PARAM_FILTER_BY_FIND, 'reset' => Sitengine_Newsletter_Backend_Campaigns_Attachments_Controller::PARAM_FILTER_RESET), $this->_controller->getNamespace());
         $sorting = $table->getSortingInstance($this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT), $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER));
         ########################################################################
         #### SETTINGS
         ########################################################################
         $settingsIsActive = false;
         $settingsElements = array();
         ### ipp element ###
         $defaultIpp = 20;
         $valueIpp = $this->_controller->getPreferences()->getItemsPerPage();
         $valueIpp = is_numeric($valueIpp) ? $valueIpp : $defaultIpp;
         $valueIpp = $valueIpp <= 100 && $valueIpp >= 1 ? $valueIpp : $defaultIpp;
         # set html input element
         $ippValues = array('' => $this->_controller->getTranslate()->translate('indexViewSettingsSectionItemsPerPage'), 5 => 5, 10 => 10, 20 => 20, 50 => 50, 100 => 100);
         $e = new Sitengine_Form_Element(Sitengine_Env::PARAM_IPP, $valueIpp);
         $e->setId('settings' . Sitengine_Env::PARAM_IPP);
         $e->setClass('settingsSelect');
         $settingsElements[Sitengine_Env::PARAM_IPP] = $e->getSelect($ippValues);
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $settingsData = array('isActive' => $settingsIsActive, 'hiddens' => implode('', $hiddens), 'ELEMENTS' => $settingsElements);
         ########################################################################
         #### FILTER
         ########################################################################
         $e = new Sitengine_Form_Element(Sitengine_Newsletter_Backend_Campaigns_Attachments_Controller::PARAM_FILTER_BY_FIND, $filter->getVal(Sitengine_Newsletter_Backend_Campaigns_Attachments_Controller::PARAM_FILTER_BY_FIND));
         $e->setId('filter' . Sitengine_Newsletter_Backend_Campaigns_Attachments_Controller::PARAM_FILTER_BY_FIND);
         $e->setClass('filterText');
         $filter->setElement(Sitengine_Newsletter_Backend_Campaigns_Attachments_Controller::PARAM_FILTER_BY_FIND, $e->getText(20));
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Newsletter_Backend_Campaigns_Attachments_Controller::PARAM_FILTER_RESET => 1);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS);
         $uriReset = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriReset .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $filterData = array('isActive' => $filter->isActive(), 'uriReset' => $uriReset, 'hiddens' => implode('', $hiddens), 'ELEMENTS' => $filter->getElements());
         ########################################################################
         #### SORTING
         ########################################################################
         $queries = array();
         foreach ($sorting->getOrdering() as $field => $order) {
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
             $query = array(Sitengine_Env::PARAM_SORT => $field, Sitengine_Env::PARAM_ORDER => $order);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS);
             $queries[$field] = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $queries[$field] .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         }
         $sortingData = array('QUERIES' => $queries, 'COLUMNS' => $sorting->getColumns());
         ########################################################################
         #### PAGER
         ########################################################################
         $pager = new Sitengine_Grid_Pager($valuePage, $valueIpp);
         ########################################################################
         #### LISTQUERY
         ########################################################################
         $name = $this->_controller->getFrontController()->getNewsletterPackage()->getAttachmentsTableName();
         $whereClauses = array($this->_controller->getDatabase()->quoteInto('campaignId = ?', $this->_controller->getEntity()->getAncestorId()), $this->_controller->getPermiso()->getDac()->getReadAccessSql($this->_controller->getFrontController()->getNewsletterPackage()->getAuthorizedGroups(), $name, false), $filter->getSql(''));
         $select = $table->select()->order($sorting->getClause())->limit($valueIpp, $pager->getOffset());
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         $items = $table->fetchAll($select);
         # if current page is out of bounds - go to beginning of list
         if (!$items->count() && $pager->getCurrPage() > 1) {
             $pager = new Sitengine_Grid_Pager(1, $valueIpp);
             $select = $table->select()->order($sorting->getClause())->limit($valueIpp, 0);
             foreach ($whereClauses as $clause) {
                 if ($clause) {
                     $select->where($clause);
                 }
             }
             $items = $table->fetchAll($select);
         }
         # count total number of records
         $select = $table->select()->from($table, array('COUNT(*) AS count'));
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         $count = $table->fetchRow($select);
         $pager->calculate($count->count);
         ########################################################################
         #### LISTDATA
         ########################################################################
         $markedRows = $this->_controller->getMarkedRows();
         $list = array();
         foreach ($items as $item) {
             $row = $table->complementRow($item);
             # row selector checkbox
             $p = 'SELECTROWITEM' . $row['id'];
             $s = sizeof($markedRows) && isset($markedRows[$row['id']]) ? $this->_controller->getRequest()->getPost($p) : 0;
             $e = new Sitengine_Form_Element($p, 1);
             $e->setClass('listformCheckbox');
             $row['rowSelectCheckbox'] = $e->getCheckbox($s);
             $fileUrl = $row['file1OriginalUri'];
             $e = new Sitengine_Form_Element('fileUrl', preg_replace('/&amp;/', '&', $fileUrl));
             $e->setClass('listformText');
             $row['file1OriginalElement'] = $e->getText(80);
             # uris
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $row['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS_SHARP);
             $row['uriUpdate'] = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $row['isMarked'] = isset($markedRows[$row['id']]) ? $markedRows[$row['id']] : 0;
             $name = 'cdate';
             $date = new Zend_Date($row[$name], Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             $row[$name] = $date->get(Zend_Date::DATE_LONG, $this->_controller->getLocale()) . ' ';
             $row[$name] .= $date->get(Zend_Date::TIME_LONG, $this->_controller->getLocale());
             $list[] = $row;
         }
         ########################################################################
         #### PAGER DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getPrevPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS);
         $uriPrevPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriPrevPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getNextPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS);
         $uriNextPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriNextPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $currPageInput = new Sitengine_Form_Element(Sitengine_Env::PARAM_PAGE, $pager->getCurrPage());
         $currPageInput->setClass('pagerInput');
         $pagerData = array('hiddens' => implode('', $hiddens), 'currPageInput' => $currPageInput->getText(2), 'currPage' => $pager->getCurrPage(), 'nextPage' => $pager->getNextPage(), 'prevPage' => $pager->getPrevPage(), 'numPages' => $pager->getNumPages(), 'numItems' => $pager->getNumItems(), 'firstItem' => $pager->getFirstItem(), 'lastItem' => $pager->getLastItem(), 'uriPrevPage' => $uriPrevPage, 'uriNextPage' => $uriNextPage);
         ########################################################################
         #### URIS
         ########################################################################
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS_BATCH);
         $uriDoBatchDelete = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Newsletter_Backend_Front::ROUTE_CAMPAIGNS_ATTACHMENTS_BATCH);
         $uriDoBatchUpdate = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uris = array('submitDoBatchDelete' => $uriDoBatchDelete, 'submitDoBatchUpdate' => $uriDoBatchUpdate);
         ########################################################################
         #### METHODS
         ########################################################################
         $methods = array('doBatchDelete' => Sitengine_Env::METHOD_DELETE, 'doBatchUpdate' => Sitengine_Env::METHOD_PUT);
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_METHOD => '', Sitengine_Env::PARAM_PAGE => $valuePage, Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('hiddens' => implode('', $hiddens), 'title' => $this->_controller->getTranslate()->translate('indexViewTitle'), 'URIS' => $uris, 'METHODS' => $methods, 'FILTER' => $filterData, 'SETTINGS' => $settingsData, 'SORTING' => $sortingData, 'DATA' => $list, 'PAGER' => $pagerData);
     } catch (Exception $exception) {
         require_once 'Sitengine/Newsletter/Backend/Campaigns/Attachments/Exception.php';
         throw new Sitengine_Newsletter_Backend_Campaigns_Attachments_Exception('list page error', $exception);
     }
 }
Пример #25
0
 public function makeFormSection()
 {
     try {
         $elements = array();
         $input = $this->_controller->getRequest()->getPost(null);
         $stored = array();
         foreach ($this->_controller->getPermiso()->getAuth()->getData() as $key => $val) {
             $stored[$key] = $val;
         }
         #Sitengine_Debug::print_r($stored);
         $inputMode = $this->_controller->getPermiso()->getAuth()->hasIdentity() ? Sitengine_Env::INPUTMODE_UPDATE : Sitengine_Env::INPUTMODE_INSERT;
         $fields = array('name' => '', 'firstname' => '', 'lastname' => '', 'nickname' => '', 'password' => '', 'country' => '', 'timezone' => 'UTC', 'newsletter' => 1);
         if ($inputMode == Sitengine_Env::INPUTMODE_UPDATE) {
             $data = Sitengine_Controller_Request_Http::filterUpdate(sizeof($input), $input, $fields, $stored);
             $data = array_merge($stored, $data);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Frontend_Front::ROUTE_USER);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
         } else {
             $data = Sitengine_Controller_Request_Http::filterInsert(sizeof($input), $input, $fields);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Frontend_Front::ROUTE_USER_NEW);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble();
         }
         $data['countryOptions'] = array_merge(array('noneSelected' => '---'), $this->_controller->getTranslate()->translateGroup('countries')->toArray());
         return array('inputMode' => $inputMode, 'submitUri' => $submitUri, 'DATA' => $data);
     } catch (Exception $exception) {
         require_once 'Sitengine/Permiso/Frontend/User/Exception.php';
         throw new Sitengine_Permiso_Frontend_User_Exception('account form section error', $exception);
     }
 }
Пример #26
0
 public function getQueries(Sitengine_Permiso $permiso)
 {
     $queries = array();
     require_once 'Zend/Controller/Router/Route/Module.php';
     $route = new Zend_Controller_Router_Route_Module(array(), $this->getDispatcher(), $this->getRequest());
     $args = array();
     $queries['backendHome'] = $this->getEnv()->getMyProjectRequestDir() . '/backend/home/' . $route->assemble($args, true);
     $args = array(Sitengine_Env::PARAM_LOGOUT => 1);
     $queries['signOut'] = $this->getRequest()->getBasePath() . '/backend/home' . Sitengine_Controller_Request_Http::makeNameValueQuery($args);
     $args = array();
     $queries['sitemapBackend'] = $this->getRequest()->getBasePath() . '/backend/sitemap/' . $route->assemble($args, true);
     return $queries;
 }
Пример #27
0
 protected function _getMainSection()
 {
     try {
         $valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getBlogPackage()->getFilesTable();
         $table->setTranscript($this->_controller->getPreferences()->getTranscript());
         $filter = $table->getFilterInstance($this->_controller->getRequest(), array('find' => Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_FIND, 'type' => Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_TYPE, 'reset' => Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_RESET), $this->_controller->getNamespace());
         $sorting = $table->getSortingInstance($this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT), $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER));
         ########################################################################
         #### SETTINGS
         ########################################################################
         $settingsIsActive = false;
         $settingsElements = array();
         ### transcript element ###
         $transcripts = $table->getTranscripts();
         $transcripts->setLanguage($this->_controller->getPreferences()->getTranscript());
         if (!$transcripts->isDefault()) {
             $settingsIsActive = true;
         }
         # set html input element
         $languages = array();
         foreach ($transcripts->get() as $symbol) {
             $languages[$symbol] = $this->_controller->getTranslate()->translate('languages' . ucfirst($symbol));
         }
         $e = new Sitengine_Form_Element(Sitengine_Env::PARAM_TRANSCRIPT, $transcripts->getSymbol());
         $e->setId('settings' . Sitengine_Env::PARAM_TRANSCRIPT);
         $e->setClass('settingsSelect');
         $settingsElements[Sitengine_Env::PARAM_TRANSCRIPT] = $e->getSelect($languages);
         ### ipp element ###
         $defaultIpp = 20;
         $valueIpp = $this->_controller->getPreferences()->getItemsPerPage();
         $valueIpp = is_numeric($valueIpp) ? $valueIpp : $defaultIpp;
         $valueIpp = $valueIpp <= 100 && $valueIpp >= 1 ? $valueIpp : $defaultIpp;
         # set html input element
         $ippValues = array('' => $this->_controller->getTranslate()->translate('labelsSettingsSectionItemsPerPage'), 5 => 5, 10 => 10, 20 => 20, 50 => 50, 100 => 100);
         $e = new Sitengine_Form_Element(Sitengine_Env::PARAM_IPP, $valueIpp);
         $e->setId('settings' . Sitengine_Env::PARAM_IPP);
         $e->setClass('settingsSelect');
         $settingsElements[Sitengine_Env::PARAM_IPP] = $e->getSelect($ippValues);
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $settingsData = array('isActive' => $settingsIsActive, 'hiddens' => implode('', $hiddens), 'ELEMENTS' => $settingsElements);
         ########################################################################
         #### FILTER
         ########################################################################
         /*
         $users = $this->_controller->getPermiso()->getDirectory()->getAllUsers();
         $values = array_merge($this->_controller->getTranslate()->translateGroup('fieldValsFilterByUid')->toArray(), $users);
         $e = new Sitengine_Form_Element(Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_UID, $filter->getVal(Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_UID));
         $e->setId('filter'.Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_UID);
         $e->setClass('filterSelect');
         $filter->setElement(Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_UID, $e->getSelect($values));
         
         $groups = $this->_controller->getPermiso()->getDirectory()->getAllGroups();
         $values = array_merge($this->_controller->getTranslate()->translateGroup('fieldValsFilterByGid')->toArray(), $groups);
         $e = new Sitengine_Form_Element(Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_GID, $filter->getVal(Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_GID));
         $e->setId('filter'.Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_GID);
         $e->setClass('filterSelect');
         $filter->setElement(Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_GID, $e->getSelect($values));
         */
         $e = new Sitengine_Form_Element(Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_FIND, $filter->getVal(Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_FIND));
         $e->setId('filter' . Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_FIND);
         $e->setClass('filterText');
         $filter->setElement(Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_BY_FIND, $e->getText(20));
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Blog_Backend_Blogs_Posts_Files_Controller::PARAM_FILTER_RESET => 1);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES);
         $uriReset = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriReset .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $filterData = array('isActive' => $filter->isActive(), 'uriReset' => $uriReset, 'hiddens' => implode('', $hiddens), 'ELEMENTS' => $filter->getElements());
         ########################################################################
         #### SORTING
         ########################################################################
         $queries = array();
         foreach ($sorting->getOrdering() as $field => $order) {
             $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
             $query = array(Sitengine_Env::PARAM_SORT => $field, Sitengine_Env::PARAM_ORDER => $order);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES);
             $queries[$field] = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $queries[$field] .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         }
         $sortingData = array('QUERIES' => $queries, 'COLUMNS' => $sorting->getColumns());
         ########################################################################
         #### PAGER
         ########################################################################
         $pager = new Sitengine_Grid_Pager($valuePage, $valueIpp);
         ########################################################################
         #### LISTQUERY
         ########################################################################
         $name = $this->_controller->getFrontController()->getBlogPackage()->getFilesTableName();
         $whereClauses = array($this->_controller->getDatabase()->quoteInto('parentId = ?', $this->_controller->getEntity()->getAncestorId()), $this->_controller->getPermiso()->getDac()->getReadAccessSql($this->_controller->getFrontController()->getBlogPackage()->getAuthorizedGroups(), $name, false), $filter->getSql(''));
         $select = $table->select()->order($sorting->getClause())->limit($valueIpp, $pager->getOffset());
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         $items = $table->fetchAll($select);
         # if current page is out of bounds - go to beginning of list
         if (!$items->count() && $pager->getCurrPage() > 1) {
             $pager = new Sitengine_Grid_Pager(1, $valueIpp);
             $select = $table->select()->order($sorting->getClause())->limit($valueIpp, 0);
             foreach ($whereClauses as $clause) {
                 if ($clause) {
                     $select->where($clause);
                 }
             }
             $items = $table->fetchAll($select);
         }
         # count total number of records
         $select = $table->select()->from($table, array('COUNT(*) AS count'));
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         $count = $table->fetchRow($select);
         $pager->calculate($count->count);
         ########################################################################
         #### LISTDATA
         ########################################################################
         $markedRows = $this->_controller->getMarkedRows();
         $list = array();
         foreach ($items as $item) {
             $row = $table->complementRow($item);
             # row selector checkbox
             $p = 'SELECTROWITEM' . $row['id'];
             $s = sizeof($markedRows) && isset($markedRows[$row['id']]) ? $this->_controller->getRequest()->getPost($p) : 0;
             $e = new Sitengine_Form_Element($p, 1);
             $e->setClass('listformCheckbox');
             $row['rowSelectCheckbox'] = $e->getCheckbox($s);
             $n = 'sorting';
             $p = 'UPDATEROWITEM' . $n . 'ITEMID' . $row['id'];
             $h = 'UPDATEROWITEMCURRENT' . $n . 'ITEMID' . $row['id'];
             $v = sizeof($markedRows) && isset($markedRows[$row['id']]) ? $this->_controller->getRequest()->getPost($p) : $row[$n];
             $e = new Sitengine_Form_Element($p, $v);
             $e->setClass('listformText');
             $sort = $e->getText(5);
             $sort .= Sitengine_Form_Element::getHidden($h, $row[$n]);
             $n = 'publish';
             $p = 'UPDATEROWITEM' . $n . 'ITEMID' . $row['id'];
             $h = 'UPDATEROWITEMCURRENT' . $n . 'ITEMID' . $row['id'];
             $s = sizeof($markedRows) && isset($markedRows[$row['id']]) ? $this->_controller->getRequest()->getPost($p) : $row[$n];
             $e = new Sitengine_Form_Element($p, 1);
             $e->setClass('listformCheckbox');
             $publish = $e->getCheckbox($s);
             $publish .= Sitengine_Form_Element::getHidden($h, $row[$n]);
             # uris
             $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $row['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES_SHARP);
             $uriUpdate = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $row['isMarked'] = isset($markedRows[$row['id']]) ? $markedRows[$row['id']] : 0;
             $row['sortingText'] = $sort;
             $row['publishCheckbox'] = $publish;
             $row['uriUpdate'] = $uriUpdate;
             $name = 'cdate';
             $date = new Zend_Date($row[$name], Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             $row[$name] = $date->get(Zend_Date::DATE_LONG, $this->_controller->getLocale()) . ' ';
             $row[$name] .= $date->get(Zend_Date::TIME_LONG, $this->_controller->getLocale());
             $list[] = $row;
         }
         #Sitengine_Debug::print_r($list);
         ########################################################################
         #### PAGER DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getPrevPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES);
         $uriPrevPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriPrevPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getNextPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES);
         $uriNextPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriNextPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $currPageInput = new Sitengine_Form_Element(Sitengine_Env::PARAM_PAGE, $pager->getCurrPage());
         $currPageInput->setClass('pagerInput');
         $pagerData = array('hiddens' => implode('', $hiddens), 'currPageInput' => $currPageInput->getText(2), 'currPage' => $pager->getCurrPage(), 'nextPage' => $pager->getNextPage(), 'prevPage' => $pager->getPrevPage(), 'numPages' => $pager->getNumPages(), 'numItems' => $pager->getNumItems(), 'firstItem' => $pager->getFirstItem(), 'lastItem' => $pager->getLastItem(), 'uriPrevPage' => $uriPrevPage, 'uriNextPage' => $uriNextPage);
         ########################################################################
         #### URIS
         ########################################################################
         $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES_BATCH);
         $uriDoBatchDelete = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $args = array(Sitengine_Env::PARAM_GREATANCESTORID => $this->_controller->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS_FILES_BATCH);
         $uriDoBatchUpdate = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uris = array('submitDoBatchDelete' => $uriDoBatchDelete, 'submitDoBatchUpdate' => $uriDoBatchUpdate);
         ########################################################################
         #### METHODS
         ########################################################################
         $methods = array('doBatchDelete' => Sitengine_Env::METHOD_DELETE, 'doBatchUpdate' => Sitengine_Env::METHOD_PUT);
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_METHOD => '', Sitengine_Env::PARAM_PAGE => $valuePage, Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $type = $this->_controller->getEntity()->getAncestorType();
         if ($type == Sitengine_Blog_Posts_Table::TYPE_GALLERY) {
             $title = $this->_controller->getTranslate()->translate('labelsListformPhotoTitle');
         } else {
             $title = $this->_controller->getTranslate()->translate('labelsListformFileTitle');
         }
         return array('hiddens' => implode('', $hiddens), 'title' => $title, 'URIS' => $uris, 'METHODS' => $methods, 'FILTER' => $filterData, 'SETTINGS' => $settingsData, 'SORTING' => $sortingData, 'DATA' => $list, 'PAGER' => $pagerData);
     } catch (Exception $exception) {
         require_once 'Sitengine/Blog/Backend/Blogs/Posts/Files/Exception.php';
         throw new Sitengine_Blog_Backend_Blogs_Posts_Files_Exception('list page error', $exception);
     }
 }
Пример #28
0
 protected function _doInsertAction()
 {
     try {
         $this->_start();
         if (!$this->getPermiso()->getAcl()->authenticatedAccessGranted()) {
             return $this->_forwardToLogin();
         }
         require_once 'Sitengine/Http.php';
         if (!Sitengine_Http::checkReferer()) {
             require_once 'Sitengine/Blog/Frontend/Blogs/Posts/Comments/Exception.php';
             throw new Sitengine_Blog_Frontend_Blogs_Posts_Comments_Exception('bad request', Sitengine_Env::ERROR_BAD_REQUEST);
         }
         $modifier = $this->_getModifierModelInstance();
         /*
         $tables = array(
         	$this->getPermiso()->getGroupsTableName() => 'READ',
             $this->getFrontController()->getBlogPackage()->getBlogsTableName() => 'READ',
             $this->getFrontController()->getBlogPackage()->getPostsTableName() => 'READ',
             $this->getFrontController()->getBlogPackage()->getCommentsTableName() => 'WRITE'
         );
         
         # lock tables
         require_once 'Sitengine/Sql.php';
         $q = Sitengine_Sql::getLockQuery($tables);
         $this->getDatabase()->getConnection()->exec($q);
         */
         if (!$this->getEntity()->start()) {
             return $this->_forwardToLogin();
         }
         $data = $modifier->insert();
         #$this->getDatabase()->getConnection()->exec('UNLOCK TABLES');
         if (is_null($data)) {
             $this->getStatus()->set(Sitengine_Env::STATUS_ERRORINSERT, $this->getTranslate()->translate(Sitengine_Env::STATUS_ERRORINSERT), true);
             return $this->_goToAction(self::ACTION_INSERT);
         } else {
             $this->getStatus()->set(Sitengine_Env::STATUS_OKINSERT, $this->getTranslate()->translate(Sitengine_Env::STATUS_OKINSERT), false);
             $this->getStatus()->save();
             # avoid double submits
             $path = array(Sitengine_Env::PARAM_ANCESTORID => $this->getEntity()->getGreatAncestorSlug(), Sitengine_Env::PARAM_ID => $this->getEntity()->getAncestorId());
             $args = array(Sitengine_Env::PARAM_SORT => 'cdate', Sitengine_Env::PARAM_ORDER => 'desc');
             $route = $this->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Frontend_Front::ROUTE_BLOGS_POSTS_SHARP);
             $uri = $this->getRequest()->getBasePath() . '/' . $route->assemble($path, true);
             $uri .= Sitengine_Controller_Request_Http::makeNameValueQuery($args, '&');
             #### EMAIL ###################################
             $subject = $this->getTranslate()->translate('mailSubject');
             $find = array('/%server%/');
             $replace = array($_SERVER['SERVER_NAME']);
             $subject = preg_replace($find, $replace, $subject);
             $body = $this->getTranslate()->translate('mailBody') . "\n";
             $find = array('/%firstname%/', '/%lastname%/', '/%nickname%/', '/%mail%/');
             $replace = array($this->getPermiso()->getAuth()->getFirstname(), $this->getPermiso()->getAuth()->getLastname(), $this->getPermiso()->getAuth()->getNickname(), $this->getPermiso()->getAuth()->getIdentity());
             $body = preg_replace($find, $replace, $body);
             $body .= "http://" . $_SERVER['SERVER_NAME'] . $uri . " (Frontend) \n";
             $body .= $this->_getCommentBackendUrl() . " (Backend)";
             if ($this->getEnv()->getModeratorSenderMail() === null || sizeof($this->getEnv()->getModeratorMails()) == 0) {
                 require_once 'Sitengine/Blog/Frontend/Blogs/Posts/Comments/Exception.php';
                 throw new Sitengine_Blog_Frontend_Blogs_Posts_Comments_Exception('moderator sender/recipients not set in config');
             }
             require_once 'Zend/Mail.php';
             $mail = new Zend_Mail();
             #require_once 'Zend/Mail/Transport/Smtp.php';
             #$transport = new Zend_Mail_Transport_Smtp('localhost');
             foreach ($this->getEnv()->getModeratorMails() as $address) {
                 #print $address.'<br />';
                 $mail->addTo($address);
             }
             $mail->setSubject($subject)->setBodyText($body)->setFrom($this->getEnv()->getModeratorSenderMail(), $this->getFrontController()->getBlogPackage()->getCommentSenderName())->send();
             #### EMAIL ###################################
             $this->getResponse()->setRedirect($uri);
             $this->getResponse()->sendResponse();
         }
     } catch (Exception $exception) {
         throw $this->_prepareErrorHandler($exception);
     }
 }
Пример #29
0
 protected function _getMainSection()
 {
     try {
         $elements = array();
         $input = $this->_controller->getRequest()->getPost(null);
         #$valueSort = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT);
         #$valueOrder = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER);
         #$valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getBlogPackage()->getBlogsTable();
         $table->setTranscript($this->_controller->getPreferences()->getTranscript());
         $transcripts = $table->getTranscripts();
         ########################################################################
         #### FILTER INPUT
         ########################################################################
         $fieldsNormal = array('id' => '', 'mdate' => '', 'slug' => '');
         foreach ($transcripts->get() as $index => $symbol) {
             $fieldsNormal['titleLang' . $index] = '';
             $fieldsNormal['markupLang' . $index] = '';
         }
         $fieldsOnOff = array('publish' => 1);
         if ($this->_inputMode == Sitengine_Env::INPUTMODE_UPDATE) {
             require_once 'Sitengine/Form/TranscriptsPayloads.php';
             $payloads = new Sitengine_Form_TranscriptsPayloads($transcripts);
             $payloads->start($this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAYLOAD_NAME));
             $stored = $this->_controller->getFrontController()->getBlogPackage()->getBlogsTable()->complementRow($this->_controller->getEntity()->getRow());
             $data = Sitengine_Controller_Request_Http::filterUpdateDeprecated(sizeof($input), $input, $fieldsNormal, $fieldsOnOff, $stored);
             $data = array_merge($stored, $data);
             # set dates to timezone
             /*
             $name = 'cdate';
             $date = new Zend_Date($stored[$name], Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             $data[$name]  = $date->get(Zend_Date::DATE_FULL).' ';
             $data[$name] .= $date->get(Zend_Date::TIME_FULL);
             */
             /*
             $name = 'mdate';
             $date = new Zend_Date($stored[$name], Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             $data[$name]  = $date->get(Zend_Date::DATE_LONG).' ';
             $data[$name] .= $date->get(Zend_Date::TIME_LONG);
             */
             $args = array(Sitengine_Env::PARAM_ID => $stored['slug']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_SHARP);
             $queryUpdate = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $childActions = array();
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $stored['slug']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_POSTS);
             $uri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $childActions['postList'] = array('uri' => $uri, 'label' => $this->_controller->getTranslate()->translate('labelsChildActionsSectionPostsIndex'), 'postfix' => ' (' . $this->_controller->getViewHelper()->countPosts($stored['id']) . ')');
             $hiddens = array(Sitengine_Env::PARAM_METHOD => Sitengine_Env::METHOD_PUT, Sitengine_Env::PARAM_PAYLOAD_NAME => $payloads->getName(), Sitengine_Env::PARAM_MDATE => $stored['mdate']);
             $args = array(Sitengine_Env::PARAM_ID => $stored['slug']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_SHARP);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $stored['titleLang' . $transcripts->getIndex()];
             $title = $title != '' ? $title : $stored['titleLang' . $transcripts->getDefaultIndex()];
         } else {
             require_once 'Sitengine/Form/TranscriptsPayloads.php';
             $payloads = new Sitengine_Form_TranscriptsPayloads($transcripts);
             $payloads->start();
             $data = Sitengine_Controller_Request_Http::filterInsertDeprecated(sizeof($input), $input, $fieldsNormal, $fieldsOnOff);
             $gid = $this->_controller->getPermiso()->getDirectory()->getGroupId($this->_controller->getFrontController()->getBlogPackage()->getOwnerGroup());
             $data[Sitengine_Permiso::FIELD_GID] = !is_null($gid) ? $gid : Sitengine_Permiso::GID_ADMINISTRATORS;
             $data[Sitengine_Permiso::FIELD_UID] = $this->_controller->getPermiso()->getAuth()->getId();
             $hiddens = array(Sitengine_Env::PARAM_PAYLOAD_NAME => $payloads->getName());
             $args = array();
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Blog_Backend_Front::ROUTE_BLOGS_NEW);
             $submitUri = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $title = $this->_controller->getTranslate()->translate('labelsViewformInsertTitle');
         }
         #Sitengine_Debug::print_r($data);
         ########################################################################
         #### ELEMENTS
         ########################################################################
         if ($payloads->isMain()) {
             /*
             if(
             	(!$data['id']) || # on insert
             	(isset($data[Sitengine_Permiso::FIELD_UID]) && $data[Sitengine_Permiso::FIELD_UID]==$this->_controller->getPermiso()->getAuth()->getId()) || # owners ok
             	#$this->_controller->getPermiso()->getUser()->hasSupervisorRights() || # supervisors ok
             	#$this->_controller->getPermiso()->getUser()->hasModeratorRights() # moderators ok
             	$this->_controller->getPermiso()->getDirectory()->userIsMember($this->_controller->getPermiso()->getAuth()->getId(), Sitengine_Permiso::GID_ADMINISTRATORS)
             )
             {
             	$n = Sitengine_Permiso::FIELD_UID;
             	$e = new Sitengine_Form_Element($n, $data[$n]);
             	$e->setClass('viewFormSelect');
             	$e->setId('viewForm'.$n);
             	$users = $this->_controller->getPermiso()->getDirectory()->getAllUsers();
             	$elements[$n] = $e->getSelect($users);
             	
             	$n = Sitengine_Permiso::FIELD_GID;
             	$e = new Sitengine_Form_Element($n, $data[$n]);
             	$e->setClass('viewFormSelect');
             	$e->setId('viewForm'.$n);
             	$groups = $this->_controller->getPermiso()->getDirectory()->getAllGroups();
             	$groups = array_merge($this->_controller->getTranslate()->translateGroup('fieldValsGid')->toArray(), $groups);
             	$elements[$n] = $e->getSelect($groups);
             	
             	$n = Sitengine_Permiso::FIELD_RAG;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_RAW;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_UAG;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_UAW;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_DAG;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             	
             	$n = Sitengine_Permiso::FIELD_DAW;
             	$e = new Sitengine_Form_Element($n, '1');
             	$e->setClass('viewFormCheckbox');
             	$e->setId('viewForm'.$n);
             	$elements[$n] = $e->getCheckbox($data[$n]);
             }
             */
             $n = 'titleLang' . $transcripts->getDefaultIndex();
             $e = new Sitengine_Form_Element($n, $data[$n]);
             $e->setClass('viewFormInput');
             $e->setId('viewForm' . $n);
             $elements['title'] = $e->getText(40);
             $n = 'markupLang' . $payloads->getTranscriptIndex();
             $e = new Sitengine_Form_Element($n, $data[$n]);
             $e->setClass('viewFormTextarea');
             $e->setId('viewForm' . $n);
             $elements[$n] = $e->getTextarea(40, 10);
             $n = 'publish';
             $e = new Sitengine_Form_Element($n, '1');
             $e->setClass('viewFormCheckbox');
             $e->setId('viewForm' . $n);
             $elements[$n] = $e->getCheckbox($data[$n]);
             $n = 'slug';
             $e = new Sitengine_Form_Element($n, $data[$n]);
             $e->setClass('viewFormInput');
             $e->setId('viewForm' . $n);
             $elements[$n] = $e->getText(40);
         }
         ########################################################################
         #### CONTENT PAYLOAD SECTION TITLE
         ########################################################################
         $contentSectionTitle = $this->_controller->getTranslate()->translate('labelsViewformContentSectionTitleDefault');
         if (sizeof($transcripts->get()) > 1) {
             if (!$payloads->isMain()) {
                 $symbol = $payloads->getTranscriptSymbol();
             } else {
                 $symbol = $transcripts->getDefaultSymbol();
             }
             $contentSectionTitle .= ' (' . $this->_controller->getTranslate()->translate('languages' . ucfirst($symbol)) . ')';
         }
         ########################################################################
         #### PAYLOAD NAV DATA
         ########################################################################
         $payloadNav = array();
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('payloadName' => $payloads->getName(), 'payloadIsMain' => $payloads->isMain(), 'payloadIsDefaultTranscript' => $payloads->isDefaultTranscript(), 'queryUpdate' => isset($queryUpdate) ? $queryUpdate : '', 'title' => $title, 'contentSectionTitle' => $contentSectionTitle, 'inputMode' => $this->_inputMode, 'hiddens' => implode('', $hiddens), 'submitUri' => $submitUri, 'ELEMENTS' => $elements, 'CHILDACTIONS' => isset($childActions) ? $childActions : array(), 'PAYLOADNAV' => $payloadNav, 'DATA' => $data);
     } catch (Exception $exception) {
         require_once 'Sitengine/Blog/Backend/Blogs/Exception.php';
         throw new Sitengine_Blog_Backend_Blogs_Exception('form page error', $exception);
     }
 }
Пример #30
0
 protected function _getMainSection()
 {
     try {
         require_once 'Sitengine/Form/Element.php';
         $valuePage = $this->_controller->getRequest()->get(Sitengine_Env::PARAM_PAGE);
         $table = $this->_controller->getFrontController()->getPermiso()->getMembershipsTable();
         $sorting = $table->getUserJoinSortingInstance($this->_controller->getRequest()->get(Sitengine_Env::PARAM_SORT), $this->_controller->getRequest()->get(Sitengine_Env::PARAM_ORDER));
         ########################################################################
         #### SETTINGS
         ########################################################################
         $settingsIsActive = false;
         ### ipp ###
         $defaultIpp = 20;
         $valueIpp = $this->_controller->getPreferences()->getItemsPerPage();
         $valueIpp = is_numeric($valueIpp) ? $valueIpp : $defaultIpp;
         $valueIpp = $valueIpp <= 100 && $valueIpp >= 1 ? $valueIpp : $defaultIpp;
         $ippValues = array('' => $this->_controller->getTranslate()->translate('indexViewSettingsSectionItemsPerPage'), 5 => 5, 10 => 10, 20 => 20, 50 => 50, 100 => 100);
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $settingsData = array('isActive' => $settingsIsActive, 'hiddens' => implode('', $hiddens), 'IPPS' => $ippValues, Sitengine_Env::PARAM_IPP => $valueIpp);
         ########################################################################
         #### FILTER
         ########################################################################
         $filter = $table->getUserJoinFilterInstance($this->_controller->getRequest(), array('find' => Sitengine_Permiso_Backend_Groups_Members_Controller::PARAM_FILTER_BY_FIND, 'reset' => Sitengine_Permiso_Backend_Groups_Members_Controller::PARAM_FILTER_RESET), $this->_controller->getNamespace());
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Permiso_Backend_Groups_Members_Controller::PARAM_FILTER_RESET => 1);
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_GROUPS_MEMBERS);
         $uriReset = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriReset .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $filterData = array('isActive' => $filter->isActive(), 'uriReset' => $uriReset, 'hiddens' => implode('', $hiddens), 'DATA' => $filter->getData());
         ########################################################################
         #### SORTING
         ########################################################################
         $queries = array();
         foreach ($sorting->getOrdering() as $field => $order) {
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
             $query = array(Sitengine_Env::PARAM_SORT => $field, Sitengine_Env::PARAM_ORDER => $order);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_GROUPS_MEMBERS);
             $queries[$field] = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $queries[$field] .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         }
         $sortingData = array('QUERIES' => $queries, 'COLUMNS' => $sorting->getColumns());
         ########################################################################
         #### PAGER
         ########################################################################
         require_once 'Sitengine/Grid/Pager.php';
         $pager = new Sitengine_Grid_Pager($valuePage, $valueIpp);
         ########################################################################
         #### LISTQUERY
         ########################################################################
         $membershipsTableName = $this->_controller->getFrontController()->getPermiso()->getMembershipsTableName();
         $usersTableName = $this->_controller->getFrontController()->getPermiso()->getUsersTableName();
         $whereClauses = array($this->_controller->getDatabase()->quoteInto("{$membershipsTableName}.groupId = ?", $this->_controller->getEntity()->getAncestorId()), "{$membershipsTableName}.userId = {$usersTableName}.id", $filter->getSql(''));
         $select = $table->select()->setIntegrityCheck(false)->from($membershipsTableName)->from($usersTableName, array('name', 'nickname', 'firstname', 'lastname'))->order($sorting->getClause())->limit($valueIpp, $pager->getOffset());
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         #print $select->__toString();
         $items = $table->fetchAll($select);
         #Sitengine_Debug::print_r($items->toArray());
         # if current page is out of bounds - go to beginning of list
         if (!$items->count() && $pager->getCurrPage() > 1) {
             $pager = new Sitengine_Grid_Pager(1, $valueIpp);
             $select = $table->select()->setIntegrityCheck(false)->from($membershipsTableName)->from($usersTableName, array('name', 'nickname', 'firstname', 'lastname'))->order($sorting->getClause())->limit($valueIpp, 0);
             foreach ($whereClauses as $clause) {
                 if ($clause) {
                     $select->where($clause);
                 }
             }
             $items = $table->fetchAll($select);
         }
         # count total number of records
         $select = $table->select()->setIntegrityCheck(false)->from($membershipsTableName, array('id'))->from($usersTableName, array('name'));
         foreach ($whereClauses as $clause) {
             if ($clause) {
                 $select->where($clause);
             }
         }
         $count = $table->fetchAll($select);
         $pager->calculate(sizeof($count));
         ########################################################################
         #### LISTDATA
         ########################################################################
         $markedRows = $this->_controller->getMarkedRows();
         $list = array();
         foreach ($items as $item) {
             $row = $table->complementRow($item);
             # row selector checkbox
             $row['rowSelectCheckbox'] = array();
             if (!$row['locked']) {
                 $name = 'SELECTROWITEM' . $row['id'];
                 $row['rowSelectCheckbox'] = array('name' => $name, 'checked' => sizeof($markedRows) && isset($markedRows[$row['id']]) ? $this->_controller->getRequest()->getPost($name) : 0);
             }
             $n = 'locked';
             $name = 'UPDATEROWITEM' . $n . 'ITEMID' . $row['id'];
             $current = 'UPDATEROWITEMCURRENT' . $n . 'ITEMID' . $row['id'];
             $row['lockedCheckbox'] = array('name' => $name, 'checked' => sizeof($markedRows) && isset($markedRows[$row['id']]) ? $this->_controller->getRequest()->getPost($name) : $row[$n], 'current' => Sitengine_Form_Element::getHidden($current, $row[$n]));
             # uris
             $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId(), Sitengine_Env::PARAM_ID => $row['id']);
             $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_GROUPS_MEMBERS_SHARP);
             $row['uriUpdate'] = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
             $row['isMarked'] = isset($markedRows[$row['id']]) ? $markedRows[$row['id']] : 0;
             $list[] = $row;
         }
         ########################################################################
         #### PAGER DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getPrevPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_GROUPS_MEMBERS);
         $uriPrevPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriPrevPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $query = array(Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder(), Sitengine_Env::PARAM_PAGE => $pager->getNextPage());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_GROUPS_MEMBERS);
         $uriNextPage = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uriNextPage .= Sitengine_Controller_Request_Http::makeNameValueQuery($query);
         $pagerData = array('hiddens' => implode('', $hiddens), 'currPage' => $pager->getCurrPage(), 'nextPage' => $pager->getNextPage(), 'prevPage' => $pager->getPrevPage(), 'numPages' => $pager->getNumPages(), 'numItems' => $pager->getNumItems(), 'firstItem' => $pager->getFirstItem(), 'lastItem' => $pager->getLastItem(), 'uriPrevPage' => $uriPrevPage, 'uriNextPage' => $uriNextPage);
         ########################################################################
         #### URIS
         ########################################################################
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_GROUPS_MEMBERS_BATCH);
         $uriDoBatchDelete = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Permiso_Backend_Front::ROUTE_GROUPS_MEMBERS_BATCH);
         $uriDoBatchUpdate = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uris = array('submitDoBatchDelete' => $uriDoBatchDelete, 'submitDoBatchUpdate' => $uriDoBatchUpdate);
         ########################################################################
         #### METHODS
         ########################################################################
         $methods = array('doBatchDelete' => Sitengine_Env::METHOD_DELETE, 'doBatchUpdate' => Sitengine_Env::METHOD_PUT);
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_METHOD => '', Sitengine_Env::PARAM_PAGE => $valuePage, Sitengine_Env::PARAM_SORT => $sorting->getActiveRule(), Sitengine_Env::PARAM_ORDER => $sorting->getActiveOrder());
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('hiddens' => implode('', $hiddens), 'title' => $this->_controller->getTranslate()->translate('indexViewTitle'), 'URIS' => $uris, 'METHODS' => $methods, 'FILTER' => $filterData, 'SETTINGS' => $settingsData, 'SORTING' => $sortingData, 'DATA' => $list, 'PAGER' => $pagerData);
     } catch (Exception $exception) {
         require_once 'Sitengine/Permiso/Backend/Groups/Members/Exception.php';
         throw new Sitengine_Permiso_Backend_Groups_Members_Exception('list page error', $exception);
     }
 }