本文整理汇总了PHP中Backend\Core\Engine\Language类的典型用法代码示例。如果您正苦于以下问题:PHP Language类的具体用法?PHP Language怎么用?PHP Language使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Language类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']);
}
}
}
示例2: 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']);
}
}
}
示例3: validateForm
/**
* Validate the form
*/
protected function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
$frmFields = $this->frm->getFields();
// validate form
if ($frmFields['twitter']->isChecked()) {
// we need fields when search is ticked
$frmFields['twitter_name']->isFilled(Language::err('FieldIsRequired'));
}
if ($this->frm->isCorrect()) {
// if this field is checked, let's add a boolean searchable true to the chosen fields
if ($frmFields['twitter']->isChecked()) {
$this->record['twitter'] = $frmFields['twitter_name']->getValue();
} else {
if (array_key_exists('twitter', $this->record)) {
unset($this->record['twitter']);
}
}
// save the object in our session
\SpoonSession::set('module', $this->record);
$this->redirect(Model::createURLForAction('Generate'));
}
}
}
示例4: validateForm
/**
* Validate the form
*/
protected function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
// validation
$fields = $this->frm->getFields();
$fields['username']->isFilled(Language::err('FieldIsRequired'));
if ($this->frm->isCorrect()) {
$item['id'] = $this->id;
$item['username'] = $fields['username']->getValue();
// lookup user id
$userObj = Helper::searchUser($item['username']);
if (isset($userObj->data)) {
$userId = $userObj->data[0]->id;
$item['user_id'] = $userId;
} else {
$this->redirect(Model::createURLForAction('Index') . '&error=api_error');
}
BackendInstagramModel::update($item);
$item['id'] = $this->id;
Model::triggerEvent($this->getModule(), 'after_edit', $item);
$this->redirect(Model::createURLForAction('Index') . '&report=edited&highlight=row-' . $item['id']);
}
}
}
示例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 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']);
}
}
}
示例6: validateForm
/**
* Validate the form
*/
protected function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
// validation
$fields = $this->frm->getFields();
$fields['title']->isFilled(Language::err('TitleIsRequired'));
$fields['description']->isFilled(Language::err('FieldIsRequired'));
$fields['author_name']->isFilled(Language::err('FieldIsRequired'));
$fields['author_url']->isFilled(Language::err('FieldIsRequired'));
$fields['author_email']->isFilled(Language::err('FieldIsRequired'));
// cleanup the modulename
$title = preg_replace('/[^A-Za-z ]/', '', $fields['title']->getValue());
// check if there is already a module with this name
if (BackendExtensionsModel::existsModule($title)) {
$fields['title']->addError(Language::err('DuplicateModuleName'));
}
if ($this->frm->isCorrect()) {
$this->record['title'] = $title;
$this->record['description'] = trim($fields['description']->getValue());
$this->record['author_name'] = $fields['author_name']->getValue();
$this->record['author_url'] = $fields['author_url']->getValue();
$this->record['author_email'] = $fields['author_email']->getValue();
$this->record['camel_case_name'] = BackendModuleMakerHelper::buildCamelCasedName($title);
$this->record['underscored_name'] = BackendModuleMakerHelper::buildUnderscoredName($title);
\SpoonSession::set('module', $this->record);
$this->redirect(Model::createURLForAction('AddStep2'));
}
}
}
示例7: 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();
// shorten fields
$txtName = $this->frm->getField('name');
$rbtDefaultForLanguage = $this->frm->getField('default');
// validate fields
if ($txtName->isFilled(BL::err('NameIsRequired'))) {
// check if the group exists by name
if (BackendMailmotorModel::existsGroupByName($txtName->getValue())) {
$txtName->addError(BL::err('GroupAlreadyExists'));
}
}
// no errors?
if ($this->frm->isCorrect()) {
// build item
$item['name'] = $txtName->getValue();
$item['created_on'] = BackendModel::getUTCDate('Y-m-d H:i:s');
$item['language'] = $rbtDefaultForLanguage->getValue() === '0' ? null : $rbtDefaultForLanguage->getValue();
$item['is_default'] = $rbtDefaultForLanguage->getChecked() ? 'Y' : 'N';
// insert the item
$item['id'] = BackendMailmotorCMHelper::insertGroup($item);
// check if all default groups were set
BackendMailmotorModel::checkDefaultGroups();
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_add_group', array('item' => $item));
// everything is saved, so redirect to the overview
$this->redirect(BackendModel::createURLForAction('Groups') . '&report=added&var=' . urlencode($item['name']) . '&highlight=id-' . $item['id']);
}
}
}
示例8: 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));
}
示例9: 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']);
}
}
}
示例10: 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;
}
示例11: 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);
}
}
}
示例12: 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']);
}
}
}
示例13: validateForm
private function validateForm()
{
if ($this->form->isSubmitted()) {
$fields = $this->form->getFields();
if (!$fields['start_date']->isFilled(Language::err('FieldIsRequired')) || !$fields['end_date']->isFilled(Language::err('FieldIsRequired'))) {
return;
}
if (!$fields['start_date']->isValid(Language::err('DateIsInvalid')) || !$fields['end_date']->isValid(Language::err('DateIsInvalid'))) {
return;
}
$newStartDate = Model::getUTCTimestamp($fields['start_date']);
$newEndDate = Model::getUTCTimestamp($fields['end_date']);
// startdate cannot be before 2005 (earliest valid google startdate)
if ($newStartDate < mktime(0, 0, 0, 1, 1, 2005)) {
$fields['start_date']->setError(BL::err('DateRangeIsInvalid'));
}
// enddate cannot be in the future
if ($newEndDate > time()) {
$fields['start_date']->setError(BL::err('DateRangeIsInvalid'));
}
// enddate cannot be before the startdate
if ($newStartDate > $newEndDate) {
$fields['start_date']->setError(BL::err('DateRangeIsInvalid'));
}
if ($this->form->isCorrect()) {
$this->startDate = $newStartDate;
$this->endDate = $newEndDate;
}
}
}
示例14: loadForm
/**
* Loads the settings form
*/
private function loadForm()
{
// init settings form
$this->frm = new BackendForm('settings');
$settings = BackendModel::get('fork.settings')->getForModule('Agenda');
$this->frm->addText('width1', $settings['width1']);
$this->frm->addText('height1', $settings['height1']);
$this->frm->addCheckbox('allow_enlargment1', $settings['allow_enlargment1']);
$this->frm->addCheckbox('force_aspect_ratio1', $settings['force_aspect_ratio1']);
$this->frm->addText('width1', $settings['width2']);
$this->frm->addText('height1', $settings['height2']);
$this->frm->addCheckbox('allow_enlargment2', $settings['allow_enlargment2']);
$this->frm->addCheckbox('force_aspect_ratio2', $settings['force_aspect_ratio2']);
$this->frm->addText('width3', $settings['width3']);
$this->frm->addText('height3', $settings['height3']);
$this->frm->addCheckbox('allow_enlargment3', $settings['allow_enlargment3']);
$this->frm->addCheckbox('force_aspect_ratio3', $settings['force_aspect_ratio3']);
$this->frm->addCheckbox('allow_subscriptions', $settings['allow_subscriptions']);
$this->frm->addCheckbox('moderation', $settings['moderation']);
$this->frm->addCheckbox('notify_by_email_on_new_subscription_to_moderate', $settings['notify_by_email_on_new_subscription_to_moderate']);
$this->frm->addCheckbox('notify_by_email_on_new_subscription', $settings['notify_by_email_on_new_subscription']);
$this->frm->addText('cache_timeout', $settings['cache_timeout']);
$this->frm->addDropdown('zoom_level', array_combine(array_merge(array('auto'), range(3, 18)), array_merge(array(BL::lbl('Auto', $this->getModule())), range(3, 18))), $this->get('fork.settings')->get($this->URL->getModule(), 'zoom_level_widget', 13));
$this->frm->addText('width', $this->get('fork.settings')->get($this->URL->getModule(), 'width'));
$this->frm->addText('height', $this->get('fork.settings')->get($this->URL->getModule(), 'height'));
$this->frm->addDropdown('map_type', array('ROADMAP' => BL::lbl('Roadmap', $this->getModule()), 'SATELLITE' => BL::lbl('Satellite', $this->getModule()), 'HYBRID' => BL::lbl('Hybrid', $this->getModule()), 'TERRAIN' => BL::lbl('Terrain', $this->getModule())), $this->get('fork.settings')->get($this->URL->getModule(), 'map_type_widget', 'roadmap'));
}
示例15: loadStatistics
/**
* Load the datagrid for statistics
*/
private function loadStatistics()
{
// fetch the latest mailing
$mailing = BackendMailmotorModel::getSentMailings(1);
// check if a mailing was found
if (empty($mailing)) {
return false;
}
// check if a mailing was set
if (!isset($mailing[0])) {
return false;
}
// show the sent mailings block
$this->tpl->assign('oSentMailings', true);
// fetch the statistics for this mailing
$stats = BackendMailmotorCMHelper::getStatistics($mailing[0]['id'], true);
// reformat the send date
$mailing[0]['sent'] = \SpoonDate::getDate('d-m-Y', $mailing[0]['sent']) . ' ' . BL::lbl('At') . ' ' . \SpoonDate::getDate('H:i', $mailing);
// get results
$results[] = array('label' => BL::lbl('MailmotorLatestMailing'), 'value' => $mailing[0]['name']);
$results[] = array('label' => BL::lbl('MailmotorSendDate'), 'value' => $mailing[0]['sent']);
$results[] = array('label' => BL::lbl('MailmotorSent'), 'value' => $stats['recipients'] . ' (' . $stats['recipients_percentage'] . ')');
$results[] = array('label' => BL::lbl('MailmotorOpened'), 'value' => $stats['unique_opens'] . ' (' . $stats['unique_opens_percentage'] . ')');
$results[] = array('label' => BL::lbl('MailmotorClicks'), 'value' => $stats['clicks_total'] . ' (' . $stats['clicks_percentage'] . ')');
// there are some results
if (!empty($results)) {
// get the datagrid
$dataGrid = new BackendDataGridArray($results);
// no pagination
$dataGrid->setPaging(false);
// parse the datagrid
$this->tpl->assign('dgMailmotorStatistics', $dataGrid->getContent());
}
}