本文整理汇总了PHP中SpoonFilter::ucfirst方法的典型用法代码示例。如果您正苦于以下问题:PHP SpoonFilter::ucfirst方法的具体用法?PHP SpoonFilter::ucfirst怎么用?PHP SpoonFilter::ucfirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpoonFilter
的用法示例。
在下文中一共展示了SpoonFilter::ucfirst方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadDataGrid
/**
* Load the datagrid
*/
private function loadDataGrid()
{
// create a new source-object
$source = new SpoonDataGridSourceDB(FrontendModel::getDB(), array(FrontendMailmotorModel::QRY_DATAGRID_BROWSE_SENT, array('sent', FRONTEND_LANGUAGE)));
// create datagrid
$this->dataGrid = new SpoonDataGrid($source);
$this->dataGrid->setCompileDirectory(FRONTEND_CACHE_PATH . '/compiled_templates');
// set hidden columns
$this->dataGrid->setColumnsHidden(array('id', 'status'));
// set headers values
$headers['name'] = SpoonFilter::ucfirst(FL::lbl('Name'));
$headers['send_on'] = SpoonFilter::ucfirst(FL::lbl('Sent'));
// set headers
$this->dataGrid->setHeaderLabels($headers);
// sorting columns
$this->dataGrid->setSortingColumns(array('name', 'send_on'), 'name');
$this->dataGrid->setSortParameter('desc');
// set colum URLs
$this->dataGrid->setColumnURL('name', FrontendNavigation::getURLForBlock('mailmotor', 'detail') . '/[id]');
// set column functions
$this->dataGrid->setColumnFunction(array('SpoonDate', 'getTimeAgo'), array('[send_on]'), 'send_on', true);
// add styles
$this->dataGrid->setColumnAttributes('name', array('class' => 'title'));
// set paging limit
$this->dataGrid->setPagingLimit(self::MAILINGS_PAGING_LIMIT);
}
示例2: parse
/**
* Parse the data into the template
*/
private function parse()
{
// get vars
$title = \SpoonFilter::ucfirst(FL::msg('BlogAllComments'));
$link = SITE_URL . FrontendNavigation::getURLForBlock('Blog');
$detailLink = SITE_URL . FrontendNavigation::getURLForBlock('Blog', 'Detail');
$description = null;
// create new rss instance
$rss = new FrontendRSS($title, $link, $description);
// loop articles
foreach ($this->items as $item) {
// init vars
$title = $item['author'] . ' ' . FL::lbl('On') . ' ' . $item['post_title'];
$link = $detailLink . '/' . $item['post_url'] . '/#comment-' . $item['id'];
$description = $item['text'];
// create new instance
$rssItem = new FrontendRSSItem($title, $link, $description);
// set item properties
$rssItem->setPublicationDate($item['created_on']);
$rssItem->setAuthor($item['author']);
// add item
$rss->addItem($rssItem);
}
$rss->parse();
}
示例3: loadDataGrids
/**
* Loads the datagrids
*/
private function loadDataGrids()
{
/*
* DataGrid for the subscriptions that are awaiting moderation.
*/
$this->dgModeration = new BackendDataGridDB(BackendAgendaModel::QRY_DATAGRID_BROWSE_SUBSCRIPTIONS, array('moderation', BL::getWorkingLanguage()));
// active tab
$this->dgModeration->setActiveTab('tabModeration');
// num items per page
$this->dgModeration->setPagingLimit(30);
// header labels
$this->dgModeration->setHeaderLabels(array('created_on' => \SpoonFilter::ucfirst(BL::lbl('Date'))));
// add the multi-checkbox column
$this->dgModeration->setMassActionCheckboxes('checkbox', '[id]');
// assign column functions
$this->dgModeration->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), '[created_on]', 'created_on', true);
// sorting
$this->dgModeration->setSortingColumns(array('created_on', 'name'), 'created_on');
$this->dgModeration->setSortParameter('desc');
// add mass action drop-down
$ddmMassAction = new \SpoonFormDropdown('action', array('subscribed' => BL::lbl('MoveToSubscribed'), 'delete' => BL::lbl('Delete')), 'subscribed');
$ddmMassAction->setAttribute('id', 'actionModeration');
$ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDeleteModeration'));
$ddmMassAction->setOptionAttributes('subscribe', array('data-message-id' => 'confirmSubscribedModeration'));
$this->dgModeration->setMassAction($ddmMassAction);
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit_subscription')) {
$this->dgModeration->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_subscription') . '&id=[id]', BL::lbl('Edit'));
}
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('mass_subscriptions_action')) {
$this->dgModeration->addColumn('approve', null, BL::lbl('Approve'), BackendModel::createURLForAction('mass_subscriptions_action') . '&id=[id]&from=subscribed&action=subscribed', BL::lbl('Approve'));
}
/*
* DataGrid for the subscriptions that are marked as subscribed
*/
$this->dgSubscribed = new BackendDataGridDB(BackendAgendaModel::QRY_DATAGRID_BROWSE_SUBSCRIPTIONS, array('subscribed', BL::getWorkingLanguage()));
// active tab
$this->dgSubscribed->setActiveTab('tabSubscriptions');
// num items per page
$this->dgSubscribed->setPagingLimit(30);
// header labels
$this->dgSubscribed->setHeaderLabels(array('created_on' => \SpoonFilter::ucfirst(BL::lbl('Date'))));
// add the multi-checkbox column
$this->dgSubscribed->setMassActionCheckboxes('checkbox', '[id]');
// assign column functions
$this->dgSubscribed->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), '[created_on]', 'created_on', true);
// sorting
$this->dgSubscribed->setSortingColumns(array('created_on', 'name'), 'created_on');
$this->dgSubscribed->setSortParameter('desc');
// add mass action drop-down
$ddmMassAction = new \SpoonFormDropdown('action', array('moderation' => BL::lbl('MoveToModeration'), 'delete' => BL::lbl('Delete')), 'published');
$ddmMassAction->setAttribute('id', 'actionSubscriptions');
$ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDeleteSubscribed'));
$this->dgSubscribed->setMassAction($ddmMassAction);
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit_subscription')) {
$this->dgSubscribed->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_subscription') . '&id=[id]', BL::lbl('Edit'));
}
}
示例4: loadForm
/**
* Load the form
*/
private function loadForm()
{
// gender dropdown values
$genderValues = array('male' => \SpoonFilter::ucfirst(BL::getLabel('Male')), 'female' => \SpoonFilter::ucfirst(BL::getLabel('Female')));
// birthdate dropdown values
$days = range(1, 31);
$months = \SpoonLocale::getMonths(BL::getInterfaceLanguage());
$years = range(date('Y'), 1900);
// create form
$this->frm = new BackendForm('add');
// create elements
$this->frm->addText('email')->setAttribute('type', 'email');
$this->frm->addPassword('password');
$this->frm->addText('display_name');
$this->frm->addText('first_name');
$this->frm->addText('last_name');
$this->frm->addText('city');
$this->frm->addDropdown('gender', $genderValues);
$this->frm->addDropdown('day', array_combine($days, $days));
$this->frm->addDropdown('month', $months);
$this->frm->addDropdown('year', array_combine($years, $years));
$this->frm->addDropdown('country', Intl::getRegionBundle()->getCountryNames(BL::getInterfaceLanguage()));
// set default elements dropdowns
$this->frm->getField('gender')->setDefaultElement('');
$this->frm->getField('day')->setDefaultElement('');
$this->frm->getField('month')->setDefaultElement('');
$this->frm->getField('year')->setDefaultElement('');
$this->frm->getField('country')->setDefaultElement('');
}
示例5: loadDataGrid
/**
* Loads the datagrid with the clicked link
*/
private function loadDataGrid()
{
// no statistics found
if (empty($this->statistics['clicked_links'])) {
return false;
}
// map urlencode to clicked links stack
$this->statistics['clicked_links'] = SpoonFilter::arrayMapRecursive('urlencode', $this->statistics['clicked_links']);
// create a new source-object
$source = new SpoonDataGridSourceArray($this->statistics['clicked_links']);
// call the parent, as in create a new datagrid with the created source
$this->dataGrid = new BackendDataGrid($source);
$this->dataGrid->setURL(BackendModel::createURLForAction() . '&offset=[offset]&order=[order]&sort=[sort]&id=' . $this->id);
// set headers values
$headers['link'] = strtoupper(BL::lbl('URL'));
$headers['clicks'] = SpoonFilter::ucfirst(BL::msg('ClicksAmount'));
// set headers
$this->dataGrid->setHeaderLabels($headers);
// sorting columns
$this->dataGrid->setSortingColumns(array('link', 'clicks'), 'link');
// set colunn functions
$this->dataGrid->setColumnFunction('urldecode', array('[link]'), 'link', true);
$this->dataGrid->setColumnFunction('urldecode', array('[link]'), 'link', true);
// set paging limit
$this->dataGrid->setPagingLimit(self::PAGING_LIMIT);
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('statistics_link')) {
// add edit column
$this->dataGrid->addColumnAction('users', null, BL::lbl('Who'), BackendModel::createURLForAction('statistics_link') . '&url=[link]&mailing_id=' . $this->id, BL::lbl('Who'));
}
}
示例6: parseLineChartData
/**
* Parses the data to make the line chart
*
* @param array $metricsPerDay All needed metrics grouped by day.
*/
private function parseLineChartData($metricsPerDay)
{
$maxYAxis = 2;
$metrics = array('pageviews');
$graphData = array();
foreach ($metrics as $i => $metric) {
// build graph data array
$graphData[$i] = array();
$graphData[$i]['title'] = $metric;
$graphData[$i]['label'] = SpoonFilter::ucfirst(BL::lbl(SpoonFilter::toCamelCase($metric)));
$graphData[$i]['data'] = array();
foreach ($metricsPerDay as $j => $data) {
// cast SimpleXMLElement to array
$data = (array) $data;
$graphData[$i]['data'][$j]['date'] = (int) $data['timestamp'];
$graphData[$i]['data'][$j]['value'] = (string) $data[$metric];
}
}
// loop the metrics
foreach ($graphData as $metric) {
foreach ($metric['data'] as $data) {
// get the maximum value
if ((int) $data['value'] > $maxYAxis) {
$maxYAxis = (int) $data['value'];
}
}
}
$this->tpl->assign('maxYAxis', $maxYAxis);
$this->tpl->assign('tickInterval', $maxYAxis == 2 ? '1' : '');
$this->tpl->assign('lineGraphData', $graphData);
}
示例7: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// current status
$from = \SpoonFilter::getGetValue('from', array('subscribed', 'moderation'), 'subscribed');
// action to execute
$action = \SpoonFilter::getGetValue('action', array('subscribed', 'moderation', 'delete'), 'moderation');
// no id's provided
if (!isset($_GET['id'])) {
$this->redirect(BackendModel::createURLForAction('subscriptions') . '&error=no-subscriptions-selected');
}
// redefine id's
$ids = (array) $_GET['id'];
// delete comment(s)
if ($action == 'delete') {
BackendAgendaModel::deleteSubscriptions($ids);
} else {
// set new status
BackendAgendaModel::updateSubscriptionStatuses($ids, $action);
}
// define report
$report = count($ids) > 1 ? 'subscriptions-' : 'subscription-';
// init var
if ($action == 'subscribed') {
$report .= 'moved-subscribed';
}
if ($action == 'moderation') {
$report .= 'moved-moderation';
}
if ($action == 'delete') {
$report .= 'deleted';
}
// redirect
$this->redirect(BackendModel::createURLForAction('subscriptions') . '&report=' . $report . '#tab' . \SpoonFilter::ucfirst($from));
}
示例8: parseChartData
/**
* Parses the data to make the chart with
*/
private function parseChartData()
{
$maxYAxis = 2;
$metrics = array('visitors', 'pageviews');
$graphData = array();
$metricsPerDay = BackendAnalyticsModel::getMetricsPerDay($metrics, $this->startTimestamp, $this->endTimestamp);
foreach ($metrics as $i => $metric) {
$graphData[$i] = array();
$graphData[$i]['title'] = $metric;
$graphData[$i]['label'] = SpoonFilter::ucfirst(BL::lbl(SpoonFilter::toCamelCase($metric)));
$graphData[$i]['i'] = $i + 1;
$graphData[$i]['data'] = array();
foreach ($metricsPerDay as $j => $data) {
// cast SimpleXMLElement to array
$data = (array) $data;
// build array
$graphData[$i]['data'][$j]['date'] = (int) $data['timestamp'];
$graphData[$i]['data'][$j]['value'] = (string) $data[$metric];
}
}
// loop the metrics
foreach ($graphData as $metric) {
foreach ($metric['data'] as $data) {
// get the maximum value
if ((int) $data['value'] > $maxYAxis) {
$maxYAxis = (int) $data['value'];
}
}
}
$this->tpl->assign('maxYAxis', $maxYAxis);
$this->tpl->assign('tickInterval', $maxYAxis == 2 ? '1' : '');
$this->tpl->assign('graphData', $graphData);
}
示例9: loadForm
/**
* Load the form
*/
protected function loadForm()
{
// create form
$this->frm = new Form('edit');
$this->frm->addText('title', $this->record['title'], null, 'inputText title', 'inputTextError title');
$this->frm->addEditor('text', $this->record['text']);
//$this->frm->addText('link', $this->record['link']);
$this->frm->addText('linktext', $this->record['linktext']);
$this->frm->addImage('image');
// build array with options for the hidden Radiobutton
$RadiobuttonHiddenValues[] = array('label' => Language::lbl('Hidden'), 'value' => 'Y');
$RadiobuttonHiddenValues[] = array('label' => Language::lbl('Published'), 'value' => 'N');
$this->frm->addRadioButton('hidden', $RadiobuttonHiddenValues, $this->record['hidden']);
// get categories
$categories = BackendBlocksModel::getCategories();
$this->frm->addDropdown('category_id', $categories, $this->record['category_id']);
// meta
$this->meta = new Meta($this->frm, $this->record['meta_id'], 'title', true);
$this->meta->setUrlCallBack('Backend\\Modules\\Blocks\\Engine\\Model', 'getUrl', array($this->record['id']));
// redirect
$redirectValue = 'none';
if (isset($this->record['page_id'])) {
$redirectValue = 'internal';
}
if (isset($this->record['link'])) {
$redirectValue = 'external';
}
$redirectValues = array(array('value' => 'none', 'label' => \SpoonFilter::ucfirst(Language::lbl('None'))), array('value' => 'internal', 'label' => \SpoonFilter::ucfirst(Language::lbl('InternalLink')), 'variables' => array('isInternal' => true)), array('value' => 'external', 'label' => \SpoonFilter::ucfirst(Language::lbl('ExternalLink')), 'variables' => array('isExternal' => true)));
$this->frm->addRadiobutton('redirect', $redirectValues, $redirectValue);
$this->frm->addDropdown('internal_redirect', BackendPagesModel::getPagesForDropdown(), $redirectValue == 'internal' ? $this->record['page_id'] : null);
$this->frm->addText('external_redirect', $redirectValue == 'external' ? $this->record['link'] : null, null, null, null, true);
}
示例10: getData
/**
* Load the data, don't forget to validate the incoming data
*/
private function getData()
{
// validate incoming parameters
if ($this->URL->getParameter(1) === null) {
$this->redirect(FrontendNavigation::getURL(404));
}
// fetch record
$this->record = FrontendTagsModel::get($this->URL->getParameter(1));
// validate record
if (empty($this->record)) {
$this->redirect(FrontendNavigation::getURL(404));
}
// fetch modules
$this->modules = FrontendTagsModel::getModulesForTag($this->record['id']);
// loop modules
foreach ($this->modules as $module) {
// get the ids of the items linked to the tag
$otherIds = (array) $this->get('database')->getColumn('SELECT other_id
FROM modules_tags
WHERE module = ? AND tag_id = ?', array($module, $this->record['id']));
// set module class
$class = 'Frontend\\Modules\\' . $module . '\\Engine\\Model';
// get the items that are linked to the tags
$items = (array) FrontendTagsModel::callFromInterface($module, $class, 'getForTags', $otherIds);
// add into results array
if (!empty($items)) {
$this->results[] = array('name' => $module, 'label' => FL::lbl(\SpoonFilter::ucfirst($module)), 'items' => $items);
}
}
}
示例11: loadForm
/**
* Load the form
*/
private function loadForm()
{
$this->imageIsAllowed = BackendModel::getModuleSetting($this->URL->getModule(), 'show_image_form', true);
$this->frm = new BackendForm('add');
// set hidden values
$rbtHiddenValues[] = array('label' => BL::lbl('Hidden', $this->URL->getModule()), 'value' => 'Y');
$rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N');
// get categories
$categories = BackendBlogModel::getCategories();
$categories['new_category'] = SpoonFilter::ucfirst(BL::getLabel('AddCategory'));
// create elements
$this->frm->addText('title', null, null, 'inputText title', 'inputTextError title');
$this->frm->addEditor('text');
$this->frm->addEditor('introduction');
$this->frm->addRadiobutton('hidden', $rbtHiddenValues, 'N');
$this->frm->addCheckbox('allow_comments', BackendModel::getModuleSetting($this->getModule(), 'allow_comments', false));
$this->frm->addDropdown('category_id', $categories, SpoonFilter::getGetValue('category', null, null, 'int'));
if (count($categories) != 2) {
$this->frm->getField('category_id')->setDefaultElement('');
}
$this->frm->addDropdown('user_id', BackendUsersModel::getUsers(), BackendAuthentication::getUser()->getUserId());
$this->frm->addText('tags', null, null, 'inputText tagBox', 'inputTextError tagBox');
$this->frm->addDate('publish_on_date');
$this->frm->addTime('publish_on_time');
if ($this->imageIsAllowed) {
$this->frm->addImage('image');
}
// meta
$this->meta = new BackendMeta($this->frm, null, 'title', true);
}
示例12: loadDataGrids
/**
* Load the datagrids
*
* @return void
*/
private function loadDataGrids()
{
// load all categories that are in use
$categories = BackendSlideshowModel::getActiveCategories(true);
// run over categories and create datagrid for each one
foreach ($categories as $categoryId => $categoryTitle) {
// create datagrid
$dataGrid = new BackendDataGridDB(BackendSlideshowModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $categoryId));
// disable paging
$dataGrid->setPaging(false);
// set colum URLs
$dataGrid->setColumnURL('title', BackendModel::createURLForAction('Edit') . '&id=[id]');
// set column functions
$dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[publish_on]'), 'publish_on', true);
$dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getUser'), array('[user_id]'), 'user_id', true);
// set headers
$dataGrid->setHeaderLabels(array('user_id' => \SpoonFilter::ucfirst(BL::lbl('Author')), 'publish_on' => \SpoonFilter::ucfirst(BL::lbl('PublishedOn'))));
// enable drag and drop
$dataGrid->enableSequenceByDragAndDrop();
// our JS needs to know an id, so we can send the new order
$dataGrid->setRowAttributes(array('id' => '[id]'));
$dataGrid->setAttributes(array('data-action' => "GallerySequence"));
// create a column #images
$dataGrid->addColumn('images', ucfirst(BL::lbl('Images')));
$dataGrid->setColumnFunction(array('Backend\\Modules\\Slideshow\\Engine\\Model', 'getImagesByGallery'), array('[id]', true), 'images', true);
// hide columns
$dataGrid->setColumnsHidden(array('category_id', 'sequence', 'filename'));
// add edit column
$dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&id=[id]', BL::lbl('Edit'));
// set column order
$dataGrid->setColumnsSequence('dragAndDropHandle', 'title', 'images', 'user_id', 'publish_on', 'edit');
// add dataGrid to list
$this->dataGrids[] = array('id' => $categoryId, 'title' => $categoryTitle, 'content' => $dataGrid->getContent());
}
}
示例13: parse
/**
* Parse the data into the template
*/
private function parse()
{
// get vars
$title = isset($this->settings['rss_title_' . LANGUAGE]) ? $this->settings['rss_title_' . LANGUAGE] : $this->get('fork.settings')->get('Blog', 'rss_title_' . LANGUAGE, SITE_DEFAULT_TITLE);
$link = SITE_URL . FrontendNavigation::getURLForBlock('Blog');
$description = isset($this->settings['rss_description_' . LANGUAGE]) ? $this->settings['rss_description_' . LANGUAGE] : null;
// create new rss instance
$rss = new FrontendRSS($title, $link, $description);
// loop articles
foreach ($this->items as $item) {
// init vars
$title = $item['title'];
$link = $item['full_url'];
$description = $item['introduction'] != '' ? $item['introduction'] : $item['text'];
// meta is wanted
if ($this->get('fork.settings')->get('Blog', 'rss_meta_' . LANGUAGE, true)) {
// append meta
$description .= '<div class="meta">' . "\n";
$description .= ' <p><a href="' . $link . '" title="' . $title . '">' . $title . '</a> ' . sprintf(FL::msg('WrittenBy'), FrontendUser::getBackendUser($item['user_id'])->getSetting('nickname'));
$description .= ' ' . FL::lbl('In') . ' <a href="' . $item['category_full_url'] . '" title="' . $item['category_title'] . '">' . $item['category_title'] . '</a>.</p>' . "\n";
// any tags
if (isset($item['tags'])) {
// append tags-paragraph
$description .= ' <p>' . \SpoonFilter::ucfirst(FL::lbl('Tags')) . ': ';
$first = true;
// loop tags
foreach ($item['tags'] as $tag) {
// prepend separator
if (!$first) {
$description .= ', ';
}
// add
$description .= '<a href="' . $tag['full_url'] . '" rel="tag" title="' . $tag['name'] . '">' . $tag['name'] . '</a>';
// reset
$first = false;
}
// end
$description .= '.</p>' . "\n";
}
// end HTML
$description .= '</div>' . "\n";
}
// create new instance
$rssItem = new FrontendRSSItem($title, $link, $description);
// set item properties
$rssItem->setPublicationDate($item['publish_on']);
$rssItem->addCategory($item['category_title']);
$rssItem->setAuthor(FrontendUser::getBackendUser($item['user_id'])->getSetting('nickname'));
// add item
$rss->addItem($rssItem);
}
// output
$rss->parse();
}
示例14: insert
/**
* Insert an item in the database
*
* @param array $item
* @return int
*/
public static function insert(array $item)
{
$item['created_on'] = BackendModel::getUTCDate();
$item['edited_on'] = BackendModel::getUTCDate();
$db = BackendModel::get('database');
// insert extra
$item['extra_id'] = BackendModel::insertExtra('widget', 'Instagram', 'InstagramFeed');
$item['id'] = (int) $db->insert('instagram_users', $item);
// update extra (item id is now known)
BackendModel::updateExtra($item['extra_id'], 'data', array('id' => $item['id'], 'extra_label' => \SpoonFilter::ucfirst(Language::lbl('Instagram', 'InstagramFeed')) . ': ' . $item['username'], 'edit_url' => BackendModel::createURLForAction('Edit', 'Instagram', null) . '&id=' . $item['id']));
return $item['id'];
}
示例15: install
/**
* Install the module
*/
public function install()
{
// load install.sql
$this->importSQL(__DIR__ . '/Data/install.sql');
// add 'search' as a module
$this->addModule('Search');
// import locale
$this->importLocale(__DIR__ . '/Data/locale.xml');
// general settings
$this->setSetting('Search', 'overview_num_items', 10);
$this->setSetting('Search', 'validate_search', true);
// module rights
$this->setModuleRights(1, 'Search');
// action rights
$this->setActionRights(1, 'Search', 'AddSynonym');
$this->setActionRights(1, 'Search', 'EditSynonym');
$this->setActionRights(1, 'Search', 'DeleteSynonym');
$this->setActionRights(1, 'Search', 'Settings');
$this->setActionRights(1, 'Search', 'Statistics');
$this->setActionRights(1, 'Search', 'Synonyms');
// set navigation
$navigationModulesId = $this->setNavigation(null, 'Modules');
$navigationSearchId = $this->setNavigation($navigationModulesId, 'Search');
$this->setNavigation($navigationSearchId, 'Statistics', 'search/statistics');
$this->setNavigation($navigationSearchId, 'Synonyms', 'search/synonyms', array('search/add_synonym', 'search/edit_synonym'));
// settings navigation
$navigationSettingsId = $this->setNavigation(null, 'Settings');
$navigationModulesId = $this->setNavigation($navigationSettingsId, 'Modules');
$this->setNavigation($navigationModulesId, 'Search', 'search/settings');
// add extra's
$searchId = $this->insertExtra('Search', ModuleExtraType::block(), 'Search', null, null, 'N', 2000);
$this->insertExtra('Search', ModuleExtraType::widget(), 'SearchForm', 'Form', null, 'N', 2001);
// loop languages
foreach ($this->getLanguages() as $language) {
// check if a page for search already exists in this language
// @todo refactor this nasty if statement...
if (!(bool) $this->getDB()->getVar('SELECT 1
FROM pages AS p
INNER JOIN pages_blocks AS b ON b.revision_id = p.revision_id
WHERE b.extra_id = ? AND p.language = ?
LIMIT 1', array($searchId, $language))) {
// insert search
$this->insertPage(array('title' => \SpoonFilter::ucfirst($this->getLocale('Search', 'Core', $language, 'lbl', 'Frontend')), 'type' => 'root', 'language' => $language), null, array('extra_id' => $searchId, 'position' => 'main'));
}
}
// activate search on 'pages'
$this->searchPages();
// create module cache path
$filesystem = new Filesystem();
if (!$filesystem->exists(PATH_WWW . '/src/Frontend/Cache/Search')) {
$filesystem->mkdir(PATH_WWW . '/src/Frontend/Cache/Search');
}
}