本文整理汇总了PHP中BL::getWorkingLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP BL::getWorkingLanguage方法的具体用法?PHP BL::getWorkingLanguage怎么用?PHP BL::getWorkingLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BL
的用法示例。
在下文中一共展示了BL::getWorkingLanguage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// get parameters
$this->id = $this->getParameter('id', 'int');
// does the item exist
if ($this->id !== null && BackendPagesModel::existsTemplate($this->id)) {
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// init var
$success = false;
// get template (we need the title)
$item = BackendPagesModel::getTemplate($this->id);
// valid template?
if (!empty($item)) {
// delete the page
$success = BackendPagesModel::deleteTemplate($this->id);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_delete_template', array('id' => $this->id));
// build cache
BackendPagesModel::buildCache(BL::getWorkingLanguage());
}
// page is deleted, so redirect to the overview
if ($success) {
$this->redirect(BackendModel::createURLForAction('templates') . '&theme=' . $item['theme'] . '&report=deleted-template&var=' . urlencode($item['label']));
} else {
$this->redirect(BackendModel::createURLForAction('templates') . '&error=non-existing');
}
} else {
$this->redirect(BackendModel::createURLForAction('templates') . '&error=non-existing');
}
}
示例2: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$categoryTitle = trim(SpoonFilter::getPostValue('value', null, '', 'string'));
// validate
if ($categoryTitle === '') {
$this->output(self::BAD_REQUEST, null, BL::err('TitleIsRequired'));
}
// get the data
// build array
$item['title'] = SpoonFilter::htmlspecialchars($categoryTitle);
$item['language'] = BL::getWorkingLanguage();
$meta['keywords'] = $item['title'];
$meta['keywords_overwrite'] = 'N';
$meta['description'] = $item['title'];
$meta['description_overwrite'] = 'N';
$meta['title'] = $item['title'];
$meta['title_overwrite'] = 'N';
$meta['url'] = BackendBlogModel::getURLForCategory(SpoonFilter::urlise($item['title']));
// update
$item['id'] = BackendBlogModel::insertCategory($item, $meta);
// output
$this->output(self::OK, $item, vsprintf(BL::msg('AddedCategory'), array($item['title'])));
}
示例3: loadDatagrids
/**
* Loads the dataGrids
*/
private function loadDatagrids()
{
// load all categories
$categories = BackendFaqModel::getCategories(true);
// loop categories and create a dataGrid for each one
foreach ($categories as $categoryId => $categoryTitle) {
$dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $categoryId));
$dataGrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop'));
$dataGrid->setColumnsHidden(array('category_id', 'sequence'));
$dataGrid->addColumn('dragAndDropHandle', null, '<span>' . BL::lbl('Move') . '</span>');
$dataGrid->setColumnsSequence('dragAndDropHandle');
$dataGrid->setColumnAttributes('question', array('class' => 'title'));
$dataGrid->setColumnAttributes('dragAndDropHandle', array('class' => 'dragAndDropHandle'));
$dataGrid->setRowAttributes(array('id' => '[id]'));
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit')) {
$dataGrid->setColumnURL('question', BackendModel::createURLForAction('edit') . '&id=[id]');
$dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit'));
}
// add dataGrid to list
$this->dataGrids[] = array('id' => $categoryId, 'title' => $categoryTitle, 'content' => $dataGrid->getContent());
}
// set empty datagrid
$this->emptyDatagrid = new BackendDataGridArray(array(array('dragAndDropHandle' => '', 'question' => BL::msg('NoQuestionInCategory'), 'edit' => '')));
$this->emptyDatagrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop emptyGrid'));
$this->emptyDatagrid->setHeaderLabels(array('edit' => null, 'dragAndDropHandle' => null));
}
示例4: loadForm
/**
* Load the form
*
* @return void
*/
private function loadForm()
{
// create form
$this->frm = new BackendForm('add');
// fetch the campaigns
$campaigns = BackendMailmotorModel::getCampaignsAsPairs();
// fetch the groups
$groupIds = BackendMailmotorModel::getGroupIDs();
$groups = BackendMailmotorModel::getGroupsWithRecipientsForCheckboxes();
// no groups were made yet
if (empty($groups) && empty($groupIds)) {
$this->redirect(BackendModel::createURLForAction('add_group') . '&error=add-mailing-no-groups');
} elseif (empty($groups)) {
$this->redirect(BackendModel::createURLForAction('addresses') . '&error=no-subscribers');
}
// fetch the languages
$languages = BackendMailmotorModel::getLanguagesForCheckboxes();
// settings
$this->frm->addText('name');
if (count($campaigns) > 1) {
$this->frm->addDropdown('campaign', $campaigns);
}
// sender
$this->frm->addText('from_name', BackendModel::getModuleSetting($this->getModule(), 'from_name'));
$this->frm->addText('from_email', BackendModel::getModuleSetting($this->getModule(), 'from_email'));
// reply-to address
$this->frm->addText('reply_to_email', BackendModel::getModuleSetting($this->getModule(), 'reply_to_email'));
// groups - if there is only 1 group present, we select it by default
$this->frm->addMultiCheckbox('groups', $groups, count($groups) == 1 && isset($groups[0]) ? $groups[0]['value'] : false);
// languages
$this->frm->addRadiobutton('languages', $languages, BL::getWorkingLanguage());
}
示例5: validateForm
/**
* Validate the form
*
* @return void
*/
private function validateForm()
{
// is the form submitted?
if ($this->frm->isSubmitted()) {
// cleanup the submitted fields, ignore fields that were added by hackers
$this->frm->cleanupFields();
// validate field
$this->frm->getField('synonym')->isFilled(BL::err('SynonymIsRequired'));
$this->frm->getField('term')->isFilled(BL::err('TermIsRequired'));
if (BackendSearchModel::existsSynonymByTerm($this->frm->getField('term')->getValue())) {
$this->frm->getField('term')->addError(BL::err('TermExists'));
}
// no errors?
if ($this->frm->isCorrect()) {
// build item
$item = array();
$item['term'] = $this->frm->getField('term')->getValue();
$item['synonym'] = $this->frm->getField('synonym')->getValue();
$item['language'] = BL::getWorkingLanguage();
// insert the item
$id = BackendSearchModel::insertSynonym($item);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_add_synonym', array('item' => $item));
// everything is saved, so redirect to the overview
$this->redirect(BackendModel::createURLForAction('synonyms') . '&report=added-synonym&var=' . urlencode($item['term']) . '&highlight=row-' . $id);
}
}
}
示例6: validateForm
/**
* Validate the form
*/
private function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
// validate fields
$this->frm->getField('title')->isFilled(BL::err('QuestionIsRequired'));
$this->frm->getField('answer')->isFilled(BL::err('AnswerIsRequired'));
$this->frm->getField('category_id')->isFilled(BL::err('CategoryIsRequired'));
$this->meta->validate();
if ($this->frm->isCorrect()) {
// build item
$item['meta_id'] = $this->meta->save();
$item['category_id'] = $this->frm->getField('category_id')->getValue();
$item['user_id'] = BackendAuthentication::getUser()->getUserId();
$item['language'] = BL::getWorkingLanguage();
$item['question'] = $this->frm->getField('title')->getValue();
$item['answer'] = $this->frm->getField('answer')->getValue(true);
$item['created_on'] = BackendModel::getUTCDate();
$item['hidden'] = $this->frm->getField('hidden')->getValue();
$item['sequence'] = BackendFaqModel::getMaximumSequence($this->frm->getField('category_id')->getValue()) + 1;
// save the data
$item['id'] = BackendFaqModel::insert($item);
BackendTagsModel::saveTags($item['id'], $this->frm->getField('tags')->getValue(), $this->URL->getModule());
BackendModel::triggerEvent($this->getModule(), 'after_add', array('item' => $item));
// add search index
BackendSearchModel::saveIndex('faq', $item['id'], array('title' => $item['question'], 'text' => $item['answer']));
$this->redirect(BackendModel::createURLForAction('index') . '&report=added&var=' . urlencode($item['question']) . '&highlight=row-' . $item['id']);
}
}
}
示例7: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent
parent::execute();
// get parameters
$id = SpoonFilter::getPostValue('id', null, 0, 'int');
$droppedOn = SpoonFilter::getPostValue('dropped_on', null, -1, 'int');
$typeOfDrop = SpoonFilter::getPostValue('type', null, '');
// validate
if ($id === 0) {
$this->output(self::BAD_REQUEST, null, 'no id provided');
}
if ($droppedOn === -1) {
$this->output(self::BAD_REQUEST, null, 'no id provided');
}
if ($typeOfDrop == '') {
$this->output(self::BAD_REQUEST, null, 'no type provided');
}
// get page
$success = BackendPagesModel::move($id, $droppedOn, $typeOfDrop);
// build cache
BackendPagesModel::buildCache(BL::getWorkingLanguage());
// output
if ($success) {
$this->output(self::OK, BackendPagesModel::get($id), 'page moved');
} else {
$this->output(self::ERROR, null, 'page not moved');
}
}
示例8: validateForm
/**
* Validate the form
*
* @return void
*/
private function validateForm()
{
// is the form submitted?
if ($this->frm->isSubmitted()) {
// set callback for generating an unique URL
$this->meta->setURLCallback('BackendBlogModel', 'getURLForCategory');
// cleanup the submitted fields, ignore fields that were added by hackers
$this->frm->cleanupFields();
// validate fields
$this->frm->getField('title')->isFilled(BL::err('TitleIsRequired'));
// validate meta
$this->meta->validate();
// no errors?
if ($this->frm->isCorrect()) {
// build item
$item['title'] = $this->frm->getField('title')->getValue();
$item['language'] = BL::getWorkingLanguage();
$item['meta_id'] = $this->meta->save();
// insert the item
$item['id'] = BackendBlogModel::insertCategory($item);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_add_category', array('item' => $item));
// everything is saved, so redirect to the overview
$this->redirect(BackendModel::createURLForAction('categories') . '&report=added-category&var=' . urlencode($item['title']) . '&highlight=row-' . $item['id']);
}
}
}
示例9: validateForm
/**
* Validate the form
*/
private function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
// validate fields
$this->frm->getField('title')->isFilled(BL::err('TitleIsRequired'));
if ($this->frm->isCorrect()) {
// build item
$item['id'] = BackendContentBlocksModel::getMaximumId() + 1;
$item['user_id'] = BackendAuthentication::getUser()->getUserId();
$item['template'] = count($this->templates) > 1 ? $this->frm->getField('template')->getValue() : $this->templates[0];
$item['language'] = BL::getWorkingLanguage();
$item['title'] = $this->frm->getField('title')->getValue();
$item['text'] = $this->frm->getField('text')->getValue();
$item['hidden'] = $this->frm->getField('hidden')->getValue() ? 'N' : 'Y';
$item['status'] = 'active';
$item['created_on'] = BackendModel::getUTCDate();
$item['edited_on'] = BackendModel::getUTCDate();
// insert the item
$item['revision_id'] = BackendContentBlocksModel::insert($item);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_add', array('item' => $item));
// everything is saved, so redirect to the overview
$this->redirect(BackendModel::createURLForAction('index') . '&report=added&var=' . urlencode($item['title']) . '&highlight=row-' . $item['id']);
}
}
}
示例10: loadDataGrids
/**
* Load the datagrids
*
* @return void
*/
private function loadDataGrids()
{
// load all categories
$categories = BackendFaqModel::getCategories();
// run over categories and create datagrid for each one
foreach ($categories as $category) {
// create datagrid
$dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $category['id']));
// set attributes
$dataGrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop'));
// disable paging
$dataGrid->setPaging(false);
// set colum URLs
$dataGrid->setColumnURL('question', BackendModel::createURLForAction('edit') . '&id=[id]');
// set colums hidden
$dataGrid->setColumnsHidden(array('category_id', 'sequence'));
// add edit column
$dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit'));
// add a column for the handle, so users have something to hold while draging
$dataGrid->addColumn('dragAndDropHandle', null, '<span>' . BL::lbl('Move') . '</span>');
// make sure the column with the handler is the first one
$dataGrid->setColumnsSequence('dragAndDropHandle');
// add a class on the handler column, so JS knows this is just a handler
$dataGrid->setColumnAttributes('dragAndDropHandle', array('class' => 'dragAndDropHandle'));
// our JS needs to know an id, so we can send the new order
$dataGrid->setRowAttributes(array('id' => '[id]'));
// add datagrid to list
$this->dataGrids[] = array('id' => $category['id'], 'name' => $category['name'], 'content' => $dataGrid->getContent());
}
}
示例11: loadDataGrid
/**
* Load the datagrids
*/
private function loadDataGrid()
{
$this->dataGrid = new BackendDataGridDB(BackendContentBlocksModel::QRY_BROWSE, array('active', BL::getWorkingLanguage()));
$this->dataGrid->setSortingColumns(array('title'));
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit')) {
$this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit') . '&id=[id]');
$this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit'));
}
}
示例12: setFilter
/**
* Sets the filter based on the $_GET array.
*/
private function setFilter()
{
$this->filter['language'] = $this->getParameter('language', 'array') != '' ? $this->getParameter('language', 'array') : BL::getWorkingLanguage();
$this->filter['application'] = $this->getParameter('application');
$this->filter['module'] = $this->getParameter('module');
$this->filter['type'] = $this->getParameter('type', 'array');
$this->filter['name'] = $this->getParameter('name');
$this->filter['value'] = $this->getParameter('value');
$this->filterQuery = BackendLocaleModel::buildURLQueryByFilter($this->filter);
}
示例13: setFilter
/**
* Sets the filter based on the $_GET array.
*/
private function setFilter()
{
$this->filter['language'] = $this->getParameter('language', 'array') != '' ? $this->getParameter('language', 'array') : BL::getWorkingLanguage();
$this->filter['application'] = $this->getParameter('application');
$this->filter['module'] = $this->getParameter('module');
$this->filter['type'] = $this->getParameter('type', 'array');
$this->filter['name'] = $this->getParameter('name');
$this->filter['value'] = $this->getParameter('value');
// build query for filter
$this->filterQuery = '&' . http_build_query($this->filter);
}
示例14: loadDataGrid
/**
* Loads the datagrid
*
* @return void
*/
private function loadDataGrid()
{
// create datagrid
$this->dataGrid = new BackendDataGridDB(BackendLocationModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage()));
// sorting columns
$this->dataGrid->setSortingColumns(array('address', 'title'), 'address');
$this->dataGrid->setSortParameter('ASC');
// set colum URLs
$this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit') . '&id=[id]');
// add edit column
$this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit'));
}
示例15: loadDataGrid
/**
* Loads the datagrid
*
* @return void
*/
private function loadDataGrid()
{
// create datagrid
$this->dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE_CATEGORIES, BL::getWorkingLanguage());
// disable paging
$this->dataGrid->setPaging(false);
// enable drag and drop
$this->dataGrid->enableSequenceByDragAndDrop();
// set column URLs
$this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('edit_category') . '&id=[id]');
// add edit column
$this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_category') . '&id=[id]', BL::lbl('Edit'));
}