コード例 #1
0
ファイル: Page.php プロジェクト: rapila/cms-base
 public function getConsolidatedKeywords($sLanguageId = null, $bReturnArray = false)
 {
     if ($sLanguageId == null) {
         $sLanguageId = Session::language();
     }
     $aKeywords = array();
     $aKeywords[] = TranslationPeer::getString('meta.keywords', null, '');
     $aTags = TagPeer::tagInstancesForObject($this);
     foreach ($aTags as $iKey => $oTag) {
         $aTags[$iKey] = $oTag->getTag()->getName();
     }
     $aKeywords[] = $aTags;
     $aKeywords[] = Settings::getSetting('frontend', 'keywords', '');
     $aKeywords[] = $this->getActivePageString()->getMetaKeywords();
     $aResult = array();
     foreach ($aKeywords as $iKey => $mKeywords) {
         if (!is_array($mKeywords)) {
             $mKeywords = explode(',', $mKeywords);
         }
         foreach ($mKeywords as $sKeyword) {
             $sKeyword = trim($sKeyword);
             if (!isset($aResult[$sKeyword]) && $sKeyword !== '') {
                 $aResult[$sKeyword] = true;
             }
         }
     }
     if ($bReturnArray) {
         return array_keys($aResult);
     }
     return implode(', ', array_keys($aResult));
 }
コード例 #2
0
 public function allDocumentsByCategories()
 {
     $aResult = array();
     // find files in media dirs - large files that cannot be uploaded with http
     $aCustomFiles = array();
     $aMediaDirs = ResourceFinder::create()->addExpression('web', '/^(media|flash)$/')->addRecursion()->noCache()->returnObjects()->find();
     foreach ($aMediaDirs as $oFileResource) {
         if ($oFileResource->isFile()) {
             $aCustomFiles[$oFileResource->getRelativePath()] = $oFileResource->getInstancePrefix() . $oFileResource->getRelativePath();
         }
     }
     if (count($aCustomFiles) > 0) {
         $sCustomFiles = TranslationPeer::getString('wns.documents.custom_files');
         $aResult[$sCustomFiles] = array_flip($aCustomFiles);
     }
     // find files in database ordered by category
     foreach (DocumentCategoryQuery::create()->filterByIsExternallyManaged(false)->orderByName()->find() as $oCategory) {
         $aDocuments = DocumentQuery::create()->useDocumentCategoryQuery()->filterByIsExternallyManaged(false)->endUse()->orderByDocumentCategoryId()->orderByName()->select(array('Id', 'Name'))->find();
         foreach ($aDocuments as $aDocument) {
             $aResult[$oCategory->getName()][$aDocument['Id']] = $aDocument['Name'];
         }
     }
     $sWithoutCategory = TranslationPeer::getString('wns.documents.select_without_title');
     foreach (self::getDocumentsWithoutCategoryId() as $iId => $sName) {
         $aResult[$sWithoutCategory][$iId] = $sName;
     }
     return $aResult;
 }
コード例 #3
0
 public function getMetadataForColumn($sColumnIdentifier)
 {
     $aResult = array('is_sortable' => true);
     switch ($sColumnIdentifier) {
         case 'id':
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_DATA;
             break;
         case 'name':
             $aResult['heading'] = TranslationPeer::getString('wns.subscriber_group.name');
             break;
         case 'display_name':
             $aResult['heading'] = TranslationPeer::getString('wns.subscriber_group.display_name');
             break;
         case 'is_temporary':
             $aResult['heading'] = TranslationPeer::getString('wns.subscriber_group.is_temporary');
             $aResult['is_sortable'] = false;
             break;
         case 'link_to_subscriber_data':
             $aResult['heading'] = TranslationPeer::getString('wns.subscribers');
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_URL;
             break;
         case 'delete':
             $aResult['heading'] = ' ';
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_ICON;
             $aResult['field_name'] = 'trash';
             $aResult['is_sortable'] = false;
             break;
     }
     return $aResult;
 }
コード例 #4
0
ファイル: TagsAdminModule.php プロジェクト: rapila/cms-base
 public static function getCustomListElements()
 {
     if (TagInstancePeer::doCount(TagInstancePeer::getTaggedModelsCriteria())) {
         return array(array('tag_model_name' => CriteriaListWidgetDelegate::SELECT_ALL, 'title' => TranslationPeer::getString('wns.documents.select_all_title'), 'magic_column' => 'all'));
     }
     return array();
 }
コード例 #5
0
 public function getCustomListElements()
 {
     if ($this->oTagList->getIncludeAllAndWithout() && TagQuery::create()->filterByTagged($this->oTagList->getTaggedModelName())->count() > 0) {
         return array(array('name' => CriteriaListWidgetDelegate::SELECT_ALL, 'display_name' => TranslationPeer::getString('wns.tags.select_all_title'), 'magic_column' => 'all'), array('name' => CriteriaListWidgetDelegate::SELECT_WITHOUT, 'display_name' => TranslationPeer::getString('wns.tags.select_without_title'), 'magic_column' => 'without'));
     }
     return array();
 }
コード例 #6
0
ファイル: UserPeer.php プロジェクト: rapila/cms-base
 /**
  * @deprecated use query methods
  */
 public static function getUserOptions()
 {
     $aUserOptions = array();
     foreach (self::$USER_OPTIONS as $iKey => $iValue) {
         switch ($iKey) {
             case '2':
                 $sCheckMethod = 'hasBackendAdministrators';
                 break;
             case '3':
                 $sCheckMethod = 'hasBackendUsersWithRights';
                 break;
             case '4':
                 $sCheckMethod = 'hasBackendUsersOther';
                 break;
             case '5':
                 $sCheckMethod = 'hasFrontendUsers';
                 break;
             default:
                 $sCheckMethod = 'hasBackendUsers';
         }
         if (self::$sCheckMethod()) {
             $aUserOptions[$iKey] = TranslationPeer::getString('user.' . $iValue);
         }
     }
     return $aUserOptions;
 }
コード例 #7
0
 public function getMetadataForColumn($sColumnIdentifier)
 {
     $aResult = array('is_sortable' => false);
     switch ($sColumnIdentifier) {
         case 'id':
             $aResult['heading'] = false;
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_DATA;
             break;
         case 'name':
             $aResult['heading'] = TranslationPeer::getString('wns.tag.name');
             $aResult['is_sortable'] = true;
             break;
         case 'tag_instance_count':
             $aResult['heading'] = TranslationPeer::getString('wns.tag.instance_count');
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_NUMERIC;
             break;
         case 'language_ids_of_strings':
             $aResult['heading'] = TranslationPeer::getString('wns.tag.available_strings');
             break;
         case 'delete':
             $aResult['heading'] = ' ';
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_ICON;
             $aResult['field_name'] = 'trash';
             break;
     }
     return $aResult;
 }
コード例 #8
0
 public function getMetadataForColumn($sColumnIdentifier)
 {
     $aResult = array();
     switch ($sColumnIdentifier) {
         case 'name':
             $aResult['heading'] = TranslationPeer::getString('wns.name');
             $aResult['is_sortable'] = true;
             break;
         case 'settings':
             $aResult['heading'] = TranslationPeer::getString('wns.document_category.settings');
             break;
         case 'link_to_document_data':
             $aResult['heading'] = TranslationPeer::getString('wns.documents_count');
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_URL;
             break;
         case 'is_externally_managed':
             $aResult['heading'] = TranslationPeer::getString('wns.internally_managed_only');
             $aResult['heading_filter'] = array('externally_managed_input', $this->oExternallyManagedInputFilter->getSessionKey());
             $aResult['is_sortable'] = false;
             break;
         case 'delete':
             $aResult['heading'] = ' ';
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_ICON;
             $aResult['field_name'] = 'trash';
             break;
     }
     return $aResult;
 }
コード例 #9
0
ファイル: RolesAdminModule.php プロジェクト: rapila/cms-base
 public function getCustomListElements()
 {
     if (GroupPeer::doCount(new Criteria()) > 0) {
         return array(array('group_id' => CriteriaListWidgetDelegate::SELECT_ALL, 'name' => TranslationPeer::getString('wns.roles.select_all_title'), 'magic_column' => 'all'), array('group_id' => CriteriaListWidgetDelegate::SELECT_WITHOUT, 'name' => TranslationPeer::getString('wns.roles.select_without_group_title'), 'magic_column' => 'without'));
     }
     return array();
 }
コード例 #10
0
 public function getCustomListElements()
 {
     if ($this->getCriteria()->count() > 0) {
         return array(array('document_category_id' => CriteriaListWidgetDelegate::SELECT_ALL, 'name_with_externally_managed_state' => TranslationPeer::getString('wns.documents.select_all_title'), 'magic_column' => 'all'), array('document_category_id' => CriteriaListWidgetDelegate::SELECT_WITHOUT, 'name_with_externally_managed_state' => TranslationPeer::getString('wns.documents.select_without_title'), 'magic_column' => 'without'));
     }
     return array();
 }
コード例 #11
0
 public function getCustomListElements()
 {
     if (DocumentationQuery::create()->count() > 0) {
         return array(array('documentation_id' => CriteriaListWidgetDelegate::SELECT_ALL, 'full_name' => TranslationPeer::getString('wns.sidebar.select_all'), 'magic_column' => 'all'));
     }
     return array();
 }
コード例 #12
0
 public function getMetadataForColumn($sColumnIdentifier)
 {
     $aResult = array('is_sortable' => true);
     switch ($sColumnIdentifier) {
         case 'extension':
             $aResult['heading'] = TranslationPeer::getString('wns.extension');
             break;
         case 'document_kind':
             $aResult['heading'] = TranslationPeer::getString('wns.document_kind');
             break;
         case 'mimetype':
             $aResult['heading'] = TranslationPeer::getString('wns.mimetype');
             break;
         case 'document_count':
             $aResult['heading'] = TranslationPeer::getString('wns.documents_count');
             $aResult['is_sortable'] = false;
             break;
         case 'delete':
             $aResult['heading'] = ' ';
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_ICON;
             $aResult['field_name'] = 'trash';
             $aResult['is_sortable'] = false;
             break;
     }
     return $aResult;
 }
コード例 #13
0
 public function renderFile()
 {
     $bCleanup = Manager::usePath() === self::DO_CLEANUP;
     $aReferences = ReferenceQuery::create()->find();
     self::checkReferences($aReferences, $bCleanup);
     if (count(self::$REFERENCES_WITHOUT_FROM) === 0 && count(self::$REFERENCES_WITHOUT_TO) === 0) {
         if (!$bCleanup) {
             print TranslationPeer::getString('test_references.references_are_ok', null, null, array('count' => count($aReferences)));
         } else {
             print TranslationPeer::getString('test_references.wrong_references_removed');
             print TagWriter::quickTag('p', array(), TagWriter::quickTag('a', array('href' => LinkUtil::link(array('test_references'), 'FileManager')), TranslationPeer::getString('test_references.test_again')));
         }
     } else {
         if (count(self::$REFERENCES_WITHOUT_FROM) > 0) {
             print TagWriter::quickTag('p', array(), count(self::$REFERENCES_WITHOUT_FROM) . TranslationPeer::getString('test_references.loose_from_references_found'));
             foreach (self::$REFERENCES_WITHOUT_FROM as $oReference) {
                 print TagWriter::quickTag('p', array(), $oReference->getFromModelName() . '/' . $oReference->getFromId());
             }
         }
         if (count(self::$REFERENCES_WITHOUT_TO) > 0) {
             print TagWriter::quickTag('p', array(), count(self::$REFERENCES_WITHOUT_TO) . TranslationPeer::getString('test_references.loose_to_references_found'));
             foreach (self::$REFERENCES_WITHOUT_TO as $oReference) {
                 print TagWriter::quickTag('p', array(), $oReference->getToModelName() . '/' . $oReference->getToId());
             }
         }
         print TagWriter::quickTag('p', array(), TagWriter::quickTag('a', array('href' => LinkUtil::link(array('test_references', self::DO_CLEANUP), 'FileManager')), TranslationPeer::getString('test_references.remove_loose_ends')));
     }
 }
コード例 #14
0
 public function getStringAsHTML($sKey, $aParams = array(), $sLanguageId = null, $sDefaultValue = null)
 {
     $mResult = TranslationPeer::getString($sKey, $sLanguageId, $sDefaultValue, $aParams, true);
     $oTemplate = new Template(TemplateIdentifier::constructIdentifier('result'), null, true);
     $oTemplate->replaceIdentifier('result', $mResult);
     return $oTemplate->render();
 }
コード例 #15
0
ファイル: AdminModule.php プロジェクト: rapila/cms-base
 public static function getReferences($aReferences)
 {
     if (count($aReferences) === null) {
         return null;
     }
     $aResult = array();
     foreach ($aReferences as $oReference) {
         if ($oReference->getFromModelName() === 'LanguageObject') {
             $oReferencedFromObject = $oReference->getFrom();
             if ($oReferencedFromObject) {
                 $oContentObject = $oReferencedFromObject->getContentObject();
                 $aResult[$oReferencedFromObject->getId()]['title'] = TranslationPeer::getString('reference.used_in_page');
                 $aResult[$oReferencedFromObject->getId()]['page_name'] = $oContentObject->getPage()->getName();
                 $aResult[$oReferencedFromObject->getId()]['container_name'] = $oContentObject->getContainerName();
                 $aResult[$oReferencedFromObject->getId()]['edit_link'] = TagWriter::quickTag('a', array('href' => LinkUtil::link(array('content', $oContentObject->getPageId(), 'edit', $oContentObject->getId()), 'AdminManager')), 'edit')->render();
             } else {
                 // delete reference if getFrom() === null
                 $oReference->delete();
             }
         } else {
             $aResult[$oReference->getFromId()]['title'] = TranslationPeer::getString('reference.used_in_object');
             $aResult[$oReference->getFromId()]['object_class'] = $oReference->getFromModelName();
             $aResult[$oReference->getFromId()]['object_id'] = $oReference->getFromId();
         }
     }
     return $aResult;
 }
コード例 #16
0
 public function getCustomListElements()
 {
     if (SubscriberGroupQuery::create()->count() > 0) {
         return array(array('id' => CriteriaListWidgetDelegate::SELECT_ALL, 'readable_name' => TranslationPeer::getString('wns.subscriber_group.select_all_title'), 'magic_column' => 'all'), array('id' => CriteriaListWidgetDelegate::SELECT_WITHOUT, 'readable_name' => TranslationPeer::getString('wns.subscriber_group.select_without_title'), 'magic_column' => 'without'));
     }
     return array();
 }
コード例 #17
0
 public static function getCustomListElements()
 {
     if (count(self::getDocumentKinds()) > 0) {
         return array(array('document_kind' => CriteriaListWidgetDelegate::SELECT_ALL, 'title' => TranslationPeer::getString('wns.documents.select_all_title'), 'magic_column' => 'all'));
     }
     return array();
 }
コード例 #18
0
 public static function getNewslettersWithSentInfo($iLimit = 10)
 {
     $oCriteria = new Criteria();
     $oCriteria->addDescendingOrderByColumn(self::CREATED_AT);
     $oCriteria->addAscendingOrderByColumn(self::SUBJECT);
     $oCriteria->addJoin(self::ID, NewsletterMailingPeer::NEWSLETTER_ID, Criteria::LEFT_JOIN);
     $oCriteria->setLimit($iLimit);
     $aResult = array();
     foreach (self::doSelect($oCriteria) as $oNewsletter) {
         $oNewsletterName = '[' . $oNewsletter->getCreatedAt('Y-m-d') . '] ' . $oNewsletter->getSubject();
         $aSentFirstletters = array();
         if ($oNewsletter->hasNewsletterMailings()) {
             foreach ($oNewsletter->getNewsletterMailings() as $oNewsletterMailing) {
                 if ($oNewsletterMailing->getSubscriberGroup()) {
                     $aSentFirstletters[] = $oNewsletterMailing->getSubscriberGroup()->getNameFirstLetter();
                 } elseif ($oNewsletterMailing->getExternalMailGroupId()) {
                     $aSentFirstletters[] = 'Ext';
                 }
             }
             if (count($aSentFirstletters) > 0) {
                 $oNewsletterName .= ' [' . TranslationPeer::getString('newsletter_mailing.sent_info') . ' ' . implode(', ', $aSentFirstletters) . ']';
             }
         }
         $aResult[$oNewsletter->getId()] = $oNewsletterName;
     }
     return $aResult;
 }
コード例 #19
0
 public function getMetadataForColumn($sColumnIdentifier)
 {
     $aResult = array('is_sortable' => true);
     switch ($sColumnIdentifier) {
         case 'name':
             $aResult['heading'] = TranslationPeer::getString('wns.journal.name');
             break;
         case 'enable_comments':
             $aResult['heading'] = TranslationPeer::getString('wns.journal.enable_comments');
             break;
         case 'notify_comments':
             $aResult['heading'] = TranslationPeer::getString('wns.journal.notify_comments');
             break;
         case 'use_captcha':
             $aResult['heading'] = TranslationPeer::getString('wns.journal.use_captcha');
             break;
         case 'count_entries':
             $aResult['heading'] = TranslationPeer::getString('wns.journal.count_entries');
             $aResult['is_sortable'] = false;
             break;
         case 'delete':
             $aResult['heading'] = ' ';
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_ICON;
             $aResult['field_name'] = 'trash';
             $aResult['is_sortable'] = false;
             break;
     }
     return $aResult;
 }
コード例 #20
0
 public function getMetadataForColumn($sColumnIdentifier)
 {
     $aResult = array();
     switch ($sColumnIdentifier) {
         case 'id':
             $aResult['heading'] = false;
             $aResult['field_name'] = 'role_key';
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_DATA;
             break;
         case 'role_key':
             $aResult['heading'] = TranslationPeer::getString('wns.role.role_key');
             $aResult['is_sortable'] = true;
             break;
         case 'description':
             $aResult['heading'] = TranslationPeer::getString('wns.role.description');
             $aResult['is_sortable'] = true;
             break;
         case 'user_id':
             $aResult['heading'] = TranslationPeer::getString('wns.role.user_with_role_count');
             $aResult['field_name'] = 'user_with_role_count';
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_NUMERIC;
             break;
         case 'group_id':
             $aResult['heading'] = TranslationPeer::getString('wns.role.group_with_role_count');
             $aResult['field_name'] = 'group_with_role_count';
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_NUMERIC;
             break;
         case 'delete':
             $aResult['heading'] = ' ';
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_ICON;
             $aResult['field_name'] = 'trash';
             break;
     }
     return $aResult;
 }
コード例 #21
0
 /**
  * The render method for the login page type. When on a login page type, this is given the login action as determined by the page type. Can be either null (default), 'password_forgotten', or 'password_reset' (or any other string of which a template "$sLoginType_action_$sAction" exists).
  *
  */
 public function renderFrontend($sAction = 'login')
 {
     $aOptions = @unserialize($this->getData());
     $sLoginType = isset($aOptions[self::MODE_SELECT_KEY]) ? $aOptions[self::MODE_SELECT_KEY] : 'login';
     $this->oUser = Session::getSession()->getUser();
     if ($this->oUser) {
         $sAction = 'logout';
     }
     $oTemplate = $this->constructTemplate($sLoginType);
     if ($oTemplate->hasIdentifier('function_template')) {
         $oFunctionTemplate = null;
         try {
             $oFunctionTemplate = $this->constructTemplate("{$sLoginType}_action_{$sAction}");
         } catch (Exception $e) {
             //Fallback to the default function template for the specified action
             $oFunctionTemplate = $this->constructTemplate("login_action_{$sAction}");
         }
         $oTemplate->replaceIdentifier('function_template', $oFunctionTemplate, null, Template::LEAVE_IDENTIFIERS);
     }
     if ($this->oUser && $this->oPage) {
         $oPage = $this->oPage;
         if (Session::getSession()->hasAttribute('login_referrer_page')) {
             $oPage = Session::getSession()->getAttribute('login_referrer_page');
             Session::getSession()->resetAttribute('login_referrer_page');
         }
         if (!$this->oPage->getIsProtected() || Session::getSession()->getUser()->mayViewPage($this->oPage)) {
             $oTemplate->replaceIdentifier('fullname', Session::getSession()->getUser()->getFullName());
             $oTemplate->replaceIdentifier('name', Session::getSession()->getUser()->getUsername());
             $oTemplate->replaceIdentifier('action', LinkUtil::link(FrontendManager::$CURRENT_NAVIGATION_ITEM->getLink(), null, array('logout' => 'true')));
         } else {
             $oFlash = Flash::getFlash();
             $oFlash->addMessage('login.logged_in_no_access');
         }
     }
     $oTemplate->replaceIdentifier('login_title', TranslationPeer::getString($sAction == 'password_forgotten' ? 'wns.login.password_reset' : 'wns.login'));
     $sOrigin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : LinkUtil::linkToSelf();
     $oTemplate->replaceIdentifier('origin', $sOrigin);
     if ($sAction !== 'logout') {
         $oLoginPage = $this->oPage ? $this->oPage->getLoginPage() : null;
         $sLink = null;
         if ($oLoginPage === null) {
             $sLink = LinkUtil::link('', 'LoginManager');
         } else {
             $sLink = LinkUtil::link($oLoginPage->getFullPathArray());
         }
         $oTemplate->replaceIdentifier('action', $sLink);
     }
     if ($sAction === 'login') {
         $oLoginPage = $this->oPage ? $this->oPage->getLoginPage() : null;
         $sLink = null;
         if ($oLoginPage === null) {
             $sLink = LinkUtil::link(array(), 'LoginManager', array('password_forgotten' => 'true'));
         } else {
             $sLink = LinkUtil::link($oLoginPage->getFullPathArray(), null, array('password_forgotten' => 'true'));
         }
         $oTemplate->replaceIdentifier('password_forgotten_action', $sLink);
     }
     return $oTemplate;
 }
コード例 #22
0
 private function getDocumentations($sPreferredLanguageId)
 {
     $aMetaData = DocumentationProviderTypeModule::completeMetaData();
     $aPreferredDocumentationLanguages = array_unique(array($sPreferredLanguageId, 'de', 'en'));
     $cFormat = function ($aLanguageData) use($aPreferredDocumentationLanguages) {
         $oResult = new stdClass();
         foreach ($aPreferredDocumentationLanguages as $sLanguageId) {
             if (isset($aLanguageData[$sLanguageId])) {
                 $oResult->title = $aLanguageData[$sLanguageId]['title'];
                 $oResult->url = $aLanguageData[$sLanguageId]['url'];
             }
         }
         return $oResult;
     };
     // A list of all documentation heads, by key. Documentation heads are all the documentations whose keys do not contain a slash
     $aDocumentations = array();
     // Try to figure out how many documentations (and which ones) there are
     foreach ($aMetaData as $sKey => $aLanguageData) {
         if (strpos($sKey, '/') !== false) {
             continue;
         }
         $aDocumentations[$sKey] = $cFormat($aLanguageData);
         $aDocumentations[$sKey]->parts = array();
     }
     // Add keys to documentations
     foreach ($aMetaData as $sKey => $aLanguageData) {
         if (strpos($sKey, '/') === false) {
             continue;
         }
         $sDocumentationKey = explode('/', $sKey);
         $sPartKey = implode('/', array_slice($sDocumentationKey, 1));
         $sDocumentationKey = $sDocumentationKey[0];
         if (isset($aDocumentations[$sDocumentationKey])) {
             $aDocumentations[$sDocumentationKey]->parts[$sPartKey] = $cFormat($aLanguageData);
         } else {
             // If there are no documentations with this key, just pretend it’s a documentation in itself
             $aDocumentations[$sKey] = $cFormat($aLanguageData);
             $aDocumentations[$sKey]->parts = array();
         }
     }
     $aEmptyDocumentations = array();
     foreach ($aDocumentations as $sKey => $oDocumentation) {
         if (count($oDocumentation->parts) === 0) {
             $aEmptyDocumentations[$sKey] = $oDocumentation;
             unset($aDocumentations[$sKey]);
         }
     }
     usort($aDocumentations, function ($a, $b) {
         return strnatcasecmp($a->title, $b->title);
     });
     if (count($aEmptyDocumentations) > 0) {
         $oOthers = new stdClass();
         $oOthers->title = TranslationPeer::getString('wns.others', $sPreferredLanguageId, 'Weiteres');
         $oOthers->url = null;
         $oOthers->parts = $aEmptyDocumentations;
         $aDocumentations[] = $oOthers;
     }
     return $aDocumentations;
 }
 private function getDisplayOptions()
 {
     $aResult = array();
     foreach (DocumentationsFrontendModule::$DISPLAY_MODES as $sDisplayMode) {
         $aResult[$sDisplayMode] = TranslationPeer::getString('documentation.display_option.' . $sDisplayMode, null, $sDisplayMode);
     }
     return $aResult;
 }
コード例 #24
0
 public function deleteRow($aRowData, $oCriteria)
 {
     $bResult = false;
     $sNameSpace = TranslationPeer::getNameSpaceFromStringKey($aRowData['id']);
     if (TranslationPeer::doDelete($oCriteria) && $sNameSpace !== null) {
         $bResult = !TranslationPeer::nameSpaceExists($sNameSpace);
     }
     return array(StringDetailWidgetModule::SIDEBAR_CHANGED => $bResult);
 }
コード例 #25
0
 public function getListContents($iRowStart = 0, $iRowCount = null)
 {
     $aResult = array();
     foreach (TranslationPeer::getNamespaces() as $sNameSpace) {
         $aResult[] = array('title' => $sNameSpace, 'name_space' => "{$sNameSpace}.");
     }
     $aResult = array_merge(self::getCustomListElements(), $aResult);
     return $aResult;
 }
コード例 #26
0
 public function getSubscriberGroups()
 {
     if (SubscriberGroupQuery::create()->count() === 0) {
         $oSubscriberGroup = new SubscriberGroup();
         $oSubscriberGroup->setName(TranslationPeer::getString('wns.subscriber_group.default.name'));
         $oSubscriberGroup->setDisplayName(TranslationPeer::getString('wns.subscriber_group.default.display_name'));
         $oSubscriberGroup->save();
     }
     return SubscriberGroupQuery::create()->select(array('Id', 'Name'))->orderByName()->find()->toKeyValue('Id', 'Name');
 }
コード例 #27
0
 public function renderFile()
 {
     if ($this->oJournalComment === null) {
         throw new Exception('Hash invalid');
     }
     JournalCommentPeer::ignoreRights(true);
     $sAction = StringUtil::camelize("comment_{$this->sAction}");
     $this->{$sAction}();
     echo TranslationPeer::getString("journal_comment.executed_{$this->sAction}", null, 'done');
 }
コード例 #28
0
 public function display(Template $oTemplate, $bIsPreview = false)
 {
     $sTemplateName = $this->oPage->getTemplateNameUsed();
     $sLanguageId = Session::language();
     $oListTemplate = null;
     $oItemTemplatePrototype = null;
     try {
         $oListTemplate = new Template("search_results/{$sTemplateName}");
         $oItemTemplatePrototype = new Template("search_results/{$sTemplateName}_item");
     } catch (Exception $e) {
         $oListTemplate = new Template("search_results/default");
         $oItemTemplatePrototype = new Template("search_results/default_item");
     }
     $aResults = array();
     $sWords = isset($_REQUEST['q']) ? $_REQUEST['q'] : '';
     if ($sWords) {
         $aWords = StringUtil::getWords($sWords, false, '%');
         $oSearchWordQuery = SearchIndexWordQuery::create();
         foreach ($aWords as $sWord) {
             $sWord = Synonyms::rootFor($sWord);
             $sComparison = Criteria::EQUAL;
             if (strpos($sWord, '%') !== false) {
                 $sComparison = Criteria::LIKE;
             }
             $oSearchWordQuery->addOr(SearchIndexWordPeer::WORD, $sWord, $sComparison);
         }
         $oSearchWordQuery->joinSearchIndex()->useQuery('SearchIndex')->joinPage()->useQuery('Page')->active(true)->filterByIsProtected(false)->endUse()->endUse();
         foreach ($oSearchWordQuery->find() as $oSearchIndexWord) {
             $iId = $oSearchIndexWord->getSearchIndexId();
             if (isset($aResults[$iId])) {
                 $aResults[$iId] += $oSearchIndexWord->getCount();
             } else {
                 $aResults[$iId] = $oSearchIndexWord->getCount();
             }
         }
         arsort($aResults);
     }
     $oListTemplate->replaceIdentifier('count', count($aResults));
     $oListTemplate->replaceIdentifier('search_string', $sWords);
     if (count($aResults) === 0) {
         $oListTemplate->replaceIdentifier('no_results', TranslationPeer::getString('wns.search.no_results', null, null, array('search_string' => $sWords)));
     }
     foreach ($aResults as $iIndexId => $iCount) {
         $oIndex = SearchIndexQuery::create()->findPk(array($iIndexId, $sLanguageId));
         if (!$oIndex || !$oIndex->getPage()) {
             continue;
         }
         $oItemTemplate = clone $oItemTemplatePrototype;
         $oIndex->renderListItem($oItemTemplate);
         $oItemTemplate->replaceIdentifier('count', $iCount);
         $oListTemplate->replaceIdentifierMultiple('items', $oItemTemplate);
     }
     $oTemplate->replaceIdentifier('search_results', $oListTemplate);
 }
コード例 #29
0
ファイル: CheckAdminModule.php プロジェクト: rapila/cms-base
 public function getListContents($iRowStart = 0, $iRowCount = null)
 {
     $aResult = array();
     $aCheckOptions = array("pages", "strings", "static_strings", "config", "tags", "content");
     foreach ($aCheckOptions as $sAction) {
         $aResult[] = array('action' => $sAction, 'title' => TranslationPeer::getString('wns.check.' . $sAction));
     }
     if ($iRowCount === null) {
         $iRowCount = count($aResult);
     }
     return array_splice($aResult, $iRowStart, $iRowCount);
 }
コード例 #30
0
 public function getListContents($iRowStart = 0, $iRowCount = null)
 {
     $aResult = array();
     $aInstaller = InstallUtil::loadYamlFile(BASE_DIR . '/' . DIRNAME_MODULES . '/admin/installer/installer_options.yml');
     foreach ($aInstaller['options'] as $sSectionName => $aOptions) {
         $aResult[] = array('action' => $sSectionName, 'title' => TranslationPeer::getString('wns.backup.' . $sSectionName, null, StringUtil::makeReadableName($sSectionName)));
     }
     if ($iRowCount === null) {
         $iRowCount = count($aResult);
     }
     return array_splice($aResult, $iRowStart, $iRowCount);
 }