本文整理汇总了PHP中Backend\Core\Engine\Language::getWorkingLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::getWorkingLanguage方法的具体用法?PHP Language::getWorkingLanguage怎么用?PHP Language::getWorkingLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Backend\Core\Engine\Language
的用法示例。
在下文中一共展示了Language::getWorkingLanguage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: validateForm
/**
* Validate the form
*/
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);
}
}
}
示例3: getUrl
/**
* Retrieve the unique URL for an teamMember
*
* @param string $url
* @param int $id The id of the teamMember to ignore.
* @return string
*/
public static function getUrl($url, $id = null)
{
$url = CommonUri::getUrl((string) $url);
$database = BackendModel::get('database');
if ($id === null) {
$urlExists = (bool) $database->getVar('SELECT 1
FROM team_members AS i
INNER JOIN meta AS m
ON i.meta_id = m.id
WHERE i.language = ? AND m.url = ?
LIMIT 1', [Language::getWorkingLanguage(), $url]);
} else {
$urlExists = (bool) $database->getVar('SELECT 1
FROM team_members AS i
INNER JOIN meta AS m
ON i.meta_id = m.id
WHERE i.language = ? AND m.url = ? AND i.id != ?
LIMIT 1', [Language::getWorkingLanguage(), $url, $id]);
}
if ($urlExists) {
$url = Model::addNumber($url);
return self::getUrl($url, $id);
}
return $url;
}
示例4: 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());
}
}
示例5: validateForm
/**
* Validate the form
*/
private function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
$fields = $this->frm->getFields();
// validate fields
$fields['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 ? $fields['template']->getValue() : $this->templates[0];
$item['language'] = BL::getWorkingLanguage();
$item['title'] = $fields['title']->getValue();
$item['text'] = $fields['text']->getValue();
$item['hidden'] = $fields['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']);
}
}
}
示例6: validateForm
/**
* Validate the form
*/
private function validateForm()
{
if ($this->frm->isSubmitted()) {
// cleanup the submitted fields, ignore fields that were added by hackers
$this->frm->cleanupFields();
// validate fields
$this->frm->getField('title')->isFilled(BL::err('TitleIsRequired'));
// no errors?
if ($this->frm->isCorrect()) {
// build item
$item['title'] = $this->frm->getField('title')->getValue();
$item['language'] = BL::getWorkingLanguage();
$item['publish_on'] = BackendModel::getUTCDate('Y-m-d H:i:s');
$item['hidden'] = $this->frm->getField('hidden')->getValue();
// get the highest sequence available
$item['sequence'] = BackendGalleryModel::getMaximumCategorySequence() + 1;
// insert the item
$item['id'] = BackendGalleryModel::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']);
}
}
}
示例7: 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'));
}
}
示例8: 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'));
} else {
// 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'])));
}
}
示例9: validateForm
/**
* Validate the form
*/
private function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
// validate fields
$this->meta->validate();
if ($this->frm->isCorrect()) {
// build item
$item['language'] = BL::getWorkingLanguage();
$item['meta_id'] = $this->meta->save();
$item['sequence'] = BackendCatalogModel::getMaximumSpecificationSequence() + 1;
// save the data
$item['id'] = BackendCatalogModel::insertSpecification($item);
//--Add the languages
foreach ((array) BackendModel::get('fork.settings')->get('Core', 'languages') as $key => $language) {
$itemLanguage = array();
$itemLanguage['id'] = $item['id'];
$itemLanguage['language'] = $language;
$itemLanguage['title'] = $this->frm->getField('title_' . $language)->getValue();
BackendCatalogModel::insertSpecificationLanguage($itemLanguage);
}
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_add_specification', array('item' => $item));
// everything is saved, so redirect to the overview
$this->redirect(BackendModel::createURLForAction('specifications') . '&report=added-specification&var=' . urlencode($this->frm->getField('title_nl')->getValue()) . '&highlight=row-' . $item['id']);
}
}
}
示例10: validateForm
/**
* Validate the form
*/
protected function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
// validation
$fields = $this->frm->getFields();
$fields['name']->isFilled(BL::err('FieldIsRequired'));
$fields['email']->isFilled(BL::err('FieldIsRequired'));
$fields['email']->isEmail(BL::err('EmailIsInvalid'));
if ($this->frm->isCorrect()) {
$item['name'] = $fields['name']->getValue();
$item['email'] = $fields['email']->getValue();
$item['language'] = BL::getWorkingLanguage();
$item['id'] = BackendMailengineModel::insertUser($item);
//--Check if there are groups
if (isset($fields['groups'])) {
//--Get all the groups
$groups = $fields["groups"]->getValue();
foreach ($groups as $key => $value) {
$groupUser = array();
$groupUser["user_id"] = $item['id'];
$groupUser["group_id"] = $value;
//--Add user to the group
BackendMailengineModel::insertUserToGroup($groupUser);
}
}
BackendModel::triggerEvent($this->getModule(), 'after_add_user', $item);
$this->redirect(BackendModel::createURLForAction('users') . '&report=added&highlight=row-' . $item['id']);
}
}
}
示例11: execute
/**
* Execute the action
* We will build the classname, require the class and call the execute method.
*/
public function execute()
{
$this->loadConfig();
// is the requested action possible? If not we throw an exception.
// We don't redirect because that could trigger a redirect loop
if (!in_array($this->getAction(), $this->config->getPossibleActions())) {
throw new Exception('This is an invalid action (' . $this->getAction() . ').');
}
// build action-class
$actionClass = 'Backend\\Modules\\' . $this->getModule() . '\\Actions\\' . $this->getAction();
if ($this->getModule() == 'Core') {
$actionClass = 'Backend\\Core\\Actions\\' . $this->getAction();
}
if (!class_exists($actionClass)) {
throw new Exception('The class ' . $actionClass . ' could not be found.');
}
// get working languages
$languages = Language::getWorkingLanguages();
$workingLanguages = array();
// loop languages and build an array that we can assign
foreach ($languages as $abbreviation => $label) {
$workingLanguages[] = array('abbr' => $abbreviation, 'label' => $label, 'selected' => $abbreviation == Language::getWorkingLanguage());
}
// assign the languages
$this->tpl->assign('workingLanguages', $workingLanguages);
// create action-object
/** @var $object BackendBaseAction */
$object = new $actionClass($this->getKernel());
$this->getContainer()->get('logger')->info("Executing backend action '{$object->getAction()}' for module '{$object->getModule()}'.");
$object->execute();
return $object->getContent();
}
示例12: loadForm
/**
* Load the form
*/
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('AddGroup') . '&error=add-mailing-no-groups');
} elseif (empty($groups)) {
// groups were made, but none have subscribers
$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', $this->get('fork.settings')->get($this->getModule(), 'from_name'));
$this->frm->addText('from_email', $this->get('fork.settings')->get($this->getModule(), 'from_email'));
// reply-to address
$this->frm->addText('reply_to_email', $this->get('fork.settings')->get($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());
}
示例13: 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 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();
$item['sequence'] = BackendSlideshowModel::getMaximumCategorySequence() + 1;
// insert the item
$item['id'] = BackendSlideshowModel::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=' . $item['id']);
}
}
}
示例14: loadDataGrid
/**
* Load the dataGrid
*/
private function loadDataGrid()
{
// filter category
if ($this->categoryId != null) {
// create datagrid
$this->dgProducts = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE_FOR_CATEGORY, array($this->categoryId, BL::getWorkingLanguage()));
// set the URL
$this->dgProducts->setURL('&category=' . $this->categoryId, true);
} else {
// dont filter category
// create datagrid
$this->dgProducts = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage()));
}
// our JS needs to know an id, so we can highlight it
$this->dgProducts->setRowAttributes(array('id' => 'row-[id]'));
$this->dgProducts->enableSequenceByDragAndDrop();
$this->dgProducts->setColumnsHidden(array('category_id', 'sequence'));
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('Edit')) {
// set column URLs
$this->dgProducts->setColumnURL('title', BackendModel::createURLForAction('edit') . '&id=[id]&category=' . $this->categoryId);
// add edit and media column
//$this->dgProducts->addColumn('media', null, BL::lbl('Media'), BackendModel::createURLForAction('media') . '&id=[id]', BL::lbl('Media'));
$this->dgProducts->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]&category=' . $this->categoryId, BL::lbl('Edit'));
// set media column function
$this->dgProducts->setColumnFunction(array(__CLASS__, 'setMediaLink'), array('[id]'), 'media');
}
}
示例15: 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);
}