当前位置: 首页>>代码示例>>PHP>>正文


PHP Language::msg方法代码示例

本文整理汇总了PHP中Backend\Core\Language\Language::msg方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::msg方法的具体用法?PHP Language::msg怎么用?PHP Language::msg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Backend\Core\Language\Language的用法示例。


在下文中一共展示了Language::msg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addPostData

 /**
  * Add postdata into the comment
  *
  * @param string $text The comment.
  * @param string $title The title for the blogarticle.
  * @param string $url The URL for the blogarticle.
  * @param int $id The id of the comment.
  *
  * @return string
  */
 public static function addPostData($text, $title, $url, $id)
 {
     // reset URL
     $url = BackendModel::getURLForBlock('Blog', 'Detail') . '/' . $url . '#comment-' . $id;
     // build HTML
     return '<p><em>' . sprintf(BL::msg('CommentOnWithURL'), $url, $title) . '</em></p>' . "\n" . (string) $text;
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:17,代码来源:Comments.php

示例2: execute

 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     // get parameters
     $id = \SpoonFilter::getPostValue('id', null, 0, 'int');
     $tag = trim(\SpoonFilter::getPostValue('value', null, '', 'string'));
     // validate id
     if ($id === 0) {
         $this->output(self::BAD_REQUEST, null, 'no id provided');
     } else {
         // validate tag name
         if ($tag === '') {
             $this->output(self::BAD_REQUEST, null, BL::err('NameIsRequired'));
         } else {
             // check if tag exists
             if (BackendTagsModel::existsTag($tag)) {
                 $this->output(self::BAD_REQUEST, null, BL::err('TagAlreadyExists'));
             } else {
                 $item['id'] = $id;
                 $item['tag'] = \SpoonFilter::htmlspecialchars($tag);
                 $item['url'] = BackendTagsModel::getURL(CommonUri::getUrl(\SpoonFilter::htmlspecialcharsDecode($item['tag'])), $id);
                 BackendTagsModel::update($item);
                 $this->output(self::OK, $item, vsprintf(BL::msg('Edited'), array($item['tag'])));
             }
         }
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:30,代码来源:Edit.php

示例3: 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'])));
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:29,代码来源:AddCategory.php

示例4: validateForm

 /**
  * Validates the form
  */
 private function validateForm()
 {
     // is the form submitted?
     if ($this->frm->isSubmitted()) {
         // no errors ?
         if ($this->frm->isCorrect()) {
             // smtp settings
             $this->get('fork.settings')->set('Core', 'seo_noodp', $this->frm->getField('seo_noodp')->getValue());
             $this->get('fork.settings')->set('Core', 'seo_noydir', $this->frm->getField('seo_noydir')->getValue());
             $this->get('fork.settings')->set('Core', 'seo_nofollow_in_comments', $this->frm->getField('seo_nofollow_in_comments')->getValue());
             // assign report
             $this->tpl->assign('report', true);
             $this->tpl->assign('reportMessage', BL::msg('Saved'));
         }
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:19,代码来源:Seo.php

示例5: execute

 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $generalSettings = $this->get('fork.settings')->getForModule('Location');
     // get parameters
     $itemId = \SpoonFilter::getPostValue('id', null, null, 'int');
     $zoomLevel = trim(\SpoonFilter::getPostValue('zoom', null, 'auto'));
     $mapType = strtoupper(trim(\SpoonFilter::getPostValue('type', array('roadmap', 'satellite', 'hybrid', 'terrain', 'street_view'), 'roadmap')));
     $mapStyle = trim(\SpoonFilter::getPostValue('style', array('standard', 'custom', 'gray', 'blue'), 'standard'));
     $centerLat = \SpoonFilter::getPostValue('centerLat', null, 1, 'float');
     $centerlng = \SpoonFilter::getPostValue('centerLng', null, 1, 'float');
     $height = \SpoonFilter::getPostValue('height', null, $generalSettings['height'], 'int');
     $width = \SpoonFilter::getPostValue('width', null, $generalSettings['width'], 'int');
     $showLink = \SpoonFilter::getPostValue('link', array('true', 'false'), 'false', 'string');
     $showDirections = \SpoonFilter::getPostValue('directions', array('true', 'false'), 'false', 'string');
     $showOverview = \SpoonFilter::getPostValue('showOverview', array('true', 'false'), 'true', 'string');
     // reformat
     $center = array('lat' => $centerLat, 'lng' => $centerlng);
     $showLink = $showLink == 'true';
     $showDirections = $showDirections == 'true';
     $showOverview = $showOverview == 'true';
     // standard dimensions
     if ($width > 800) {
         $width = 800;
     }
     if ($width < 300) {
         $width = $generalSettings['width'];
     }
     if ($height < 150) {
         $height = $generalSettings['height'];
     }
     // no id given, this means we should update the main map
     BackendLocationModel::setMapSetting($itemId, 'zoom_level', (string) $zoomLevel);
     BackendLocationModel::setMapSetting($itemId, 'map_type', (string) $mapType);
     BackendLocationModel::setMapSetting($itemId, 'map_style', (string) $mapStyle);
     BackendLocationModel::setMapSetting($itemId, 'center', (array) $center);
     BackendLocationModel::setMapSetting($itemId, 'height', (int) $height);
     BackendLocationModel::setMapSetting($itemId, 'width', (int) $width);
     BackendLocationModel::setMapSetting($itemId, 'directions', $showDirections);
     BackendLocationModel::setMapSetting($itemId, 'full_url', $showLink);
     $item = array('id' => $itemId, 'language' => BL::getWorkingLanguage(), 'show_overview' => $showOverview ? 'Y' : 'N');
     BackendLocationModel::update($item);
     // output
     $this->output(self::OK, null, BL::msg('Success'));
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:48,代码来源:SaveLiveLocation.php

示例6: execute

 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $questionId = \SpoonFilter::getPostValue('questionId', null, '', 'int');
     $fromCategoryId = \SpoonFilter::getPostValue('fromCategoryId', null, '', 'int');
     $toCategoryId = \SpoonFilter::getPostValue('toCategoryId', null, '', 'int');
     $fromCategorySequence = \SpoonFilter::getPostValue('fromCategorySequence', null, '', 'string');
     $toCategorySequence = \SpoonFilter::getPostValue('toCategorySequence', null, '', 'string');
     // invalid question id
     if (!BackendFaqModel::exists($questionId)) {
         $this->output(self::BAD_REQUEST, null, 'question does not exist');
     } else {
         // list ids
         $fromCategorySequence = (array) explode(',', ltrim($fromCategorySequence, ','));
         $toCategorySequence = (array) explode(',', ltrim($toCategorySequence, ','));
         // is the question moved to a new category?
         if ($fromCategoryId != $toCategoryId) {
             $item['id'] = $questionId;
             $item['category_id'] = $toCategoryId;
             BackendFaqModel::update($item);
             // loop id's and set new sequence
             foreach ($toCategorySequence as $i => $id) {
                 $item = array();
                 $item['id'] = (int) $id;
                 $item['sequence'] = $i + 1;
                 // update sequence if the item exists
                 if (BackendFaqModel::exists($item['id'])) {
                     BackendFaqModel::update($item);
                 }
             }
         }
         // loop id's and set new sequence
         foreach ($fromCategorySequence as $i => $id) {
             $item['id'] = (int) $id;
             $item['sequence'] = $i + 1;
             // update sequence if the item exists
             if (BackendFaqModel::exists($item['id'])) {
                 BackendFaqModel::update($item);
             }
         }
         // success output
         $this->output(self::OK, null, Language::msg('SequenceSaved'));
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:47,代码来源:SequenceQuestions.php

示例7: loadDataGridInstallable

 /**
  * Load the data grid for installable modules.
  */
 private function loadDataGridInstallable()
 {
     // create datagrid
     $this->dataGridInstallableModules = new BackendDataGridArray($this->installableModules);
     $this->dataGridInstallableModules->setSortingColumns(array('raw_name'));
     $this->dataGridInstallableModules->setHeaderLabels(array('raw_name' => \SpoonFilter::ucfirst(BL::getLabel('Name'))));
     $this->dataGridInstallableModules->setColumnsHidden(array('installed', 'name', 'cronjobs_active'));
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('DetailModule')) {
         $this->dataGridInstallableModules->setColumnURL('raw_name', BackendModel::createURLForAction('DetailModule') . '&amp;module=[raw_name]');
         $this->dataGridInstallableModules->addColumn('details', null, BL::lbl('Details'), BackendModel::createURLForAction('DetailModule') . '&amp;module=[raw_name]', BL::lbl('Details'));
     }
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('InstallModule')) {
         // add install column
         $this->dataGridInstallableModules->addColumn('install', null, BL::lbl('Install'), BackendModel::createURLForAction('InstallModule') . '&amp;module=[raw_name]', BL::lbl('Install'));
         $this->dataGridInstallableModules->setColumnConfirm('install', sprintf(BL::msg('ConfirmModuleInstall'), '[raw_name]'), null, \SpoonFilter::ucfirst(BL::lbl('Install')) . '?');
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:22,代码来源:Modules.php

示例8: validateForm

 /**
  * Validates the settings form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         if ($this->frm->getField('send_new_profile_admin_mail')->isChecked()) {
             if ($this->frm->getField('overwrite_profile_notification_email')->isChecked()) {
                 $this->frm->getField('profile_notification_email')->isEmail(BL::msg('EmailIsRequired'));
             }
         }
         if ($this->frm->isCorrect()) {
             // set our settings
             $this->get('fork.settings')->set($this->URL->getModule(), 'send_new_profile_admin_mail', (bool) $this->frm->getField('send_new_profile_admin_mail')->getValue());
             $profileNotificationEmail = null;
             if ($this->frm->getField('overwrite_profile_notification_email')->isChecked()) {
                 $profileNotificationEmail = $this->frm->getField('profile_notification_email')->getValue();
             }
             $this->get('fork.settings')->set($this->URL->getModule(), 'profile_notification_email', $profileNotificationEmail);
             $this->get('fork.settings')->set($this->URL->getModule(), 'send_new_profile_mail', (bool) $this->frm->getField('send_new_profile_mail')->getValue());
             // redirect to the settings page
             $this->redirect(BackendModel::createURLForAction('Settings') . '&report=saved-settings');
         }
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:25,代码来源:Settings.php

示例9: execute

 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $fromEmail = \SpoonFilter::getPostValue('mailer_from_email', null, '');
     $fromName = \SpoonFilter::getPostValue('mailer_from_name', null, '');
     $toEmail = \SpoonFilter::getPostValue('mailer_to_email', null, '');
     $toName = \SpoonFilter::getPostValue('mailer_to_name', null, '');
     $replyToEmail = \SpoonFilter::getPostValue('mailer_reply_to_email', null, '');
     $replyToName = \SpoonFilter::getPostValue('mailer_reply_to_name', null, '');
     // init validation
     $errors = array();
     // validate
     if ($fromEmail == '' || !\SpoonFilter::isEmail($fromEmail)) {
         $errors['from'] = BL::err('EmailIsInvalid');
     }
     if ($toEmail == '' || !\SpoonFilter::isEmail($toEmail)) {
         $errors['to'] = BL::err('EmailIsInvalid');
     }
     if ($replyToEmail == '' || !\SpoonFilter::isEmail($replyToEmail)) {
         $errors['reply'] = BL::err('EmailIsInvalid');
     }
     // got errors?
     if (!empty($errors)) {
         $this->output(self::BAD_REQUEST, array('errors' => $errors), 'invalid fields');
     } else {
         $message = \Swift_Message::newInstance('Test')->setFrom(array($fromEmail => $fromName))->setTo(array($toEmail => $toName))->setReplyTo(array($replyToEmail => $replyToName))->setBody(BL::msg('TestMessage'), 'text/plain');
         $transport = TransportFactory::create(\SpoonFilter::getPostValue('mailer_type', array('smtp', 'mail'), 'mail'), \SpoonFilter::getPostValue('smtp_server', null, ''), \SpoonFilter::getPostValue('smtp_port', null, ''), \SpoonFilter::getPostValue('smtp_username', null, ''), \SpoonFilter::getPostValue('smtp_password', null, ''), \SpoonFilter::getPostValue('smtp_secure_layer', null, ''));
         $mailer = \Swift_Mailer::newInstance($transport);
         try {
             if ($mailer->send($message)) {
                 $this->output(self::OK, null, '');
             } else {
                 $this->output(self::ERROR, null, 'unknown');
             }
         } catch (\Exception $e) {
             $this->output(self::ERROR, null, $e->getMessage());
         }
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:42,代码来源:TestEmailConnection.php

示例10: 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->enableSequenceByDragAndDrop();
         $dataGrid->setColumnsHidden(array('category_id', 'sequence'));
         $dataGrid->setColumnAttributes('question', array('class' => 'title'));
         $dataGrid->setRowAttributes(array('id' => '[id]'));
         // check if this action is allowed
         if (BackendAuthentication::isAllowedAction('Edit')) {
             $dataGrid->setColumnURL('question', BackendModel::createURLForAction('Edit') . '&amp;id=[id]');
             $dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&amp;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' => 'table table-hover table-striped fork-data-grid jsDataGrid sequenceByDragAndDrop emptyGrid'));
     $this->emptyDatagrid->setHeaderLabels(array('edit' => null, 'dragAndDropHandle' => null));
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:27,代码来源:Index.php

示例11: validateForm

 /**
  * Validates the form.
  */
 private function validateForm()
 {
     // is the form submitted?
     if ($this->frm->isSubmitted()) {
         // no errors?
         if ($this->frm->isCorrect()) {
             // determine themes
             $newTheme = $this->frm->getField('installedThemes')->getValue();
             $oldTheme = $this->get('fork.settings')->get('Core', 'theme', 'core');
             // check if we actually switched themes
             if ($newTheme != $oldTheme) {
                 // fetch templates
                 $oldTemplates = BackendExtensionsModel::getTemplates($oldTheme);
                 $newTemplates = BackendExtensionsModel::getTemplates($newTheme);
                 // check if templates already exist
                 if (empty($newTemplates)) {
                     // templates do not yet exist; don't switch
                     $this->redirect(BackendModel::createURLForAction('Themes') . '&error=no-templates-available');
                     return;
                 }
                 // fetch current default template
                 $oldDefaultTemplatePath = $oldTemplates[$this->get('fork.settings')->get('Pages', 'default_template')]['path'];
                 // loop new templates
                 foreach ($newTemplates as $newTemplateId => $newTemplate) {
                     // check if a a similar default template exists
                     if ($newTemplate['path'] == $oldDefaultTemplatePath) {
                         // set new default id
                         $newDefaultTemplateId = (int) $newTemplateId;
                         break;
                     }
                 }
                 // no default template was found, set first template as default
                 if (!isset($newDefaultTemplateId)) {
                     $newDefaultTemplateId = array_keys($newTemplates);
                     $newDefaultTemplateId = $newDefaultTemplateId[0];
                 }
                 // update theme
                 $this->get('fork.settings')->set('Core', 'theme', $newTheme);
                 // save new default template
                 $this->get('fork.settings')->set('Pages', 'default_template', $newDefaultTemplateId);
                 // loop old templates
                 foreach ($oldTemplates as $oldTemplateId => $oldTemplate) {
                     // loop new templates
                     foreach ($newTemplates as $newTemplateId => $newTemplate) {
                         // if the templates don't match we can skip this one
                         if ($oldTemplate['path'] != $newTemplate['path']) {
                             continue;
                         }
                         // switch template
                         BackendPagesModel::updatePagesTemplates($oldTemplateId, $newTemplateId);
                         // break loop
                         continue 2;
                     }
                     // getting here meant we found no matching template for the new theme; pick first theme's template as default
                     BackendPagesModel::updatePagesTemplates($oldTemplateId, $newDefaultTemplateId);
                 }
                 // trigger event
                 BackendModel::triggerEvent($this->getModule(), 'after_changed_theme');
             }
             // assign report
             $this->tpl->assign('report', true);
             $this->tpl->assign('reportMessage', BL::msg('Saved'));
         }
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:68,代码来源:Themes.php

示例12: loadForm

 /**
  * Load the form
  */
 private function loadForm()
 {
     // get default template id
     $defaultTemplateId = $this->get('fork.settings')->get('Pages', 'default_template', 1);
     // create form
     $this->frm = new BackendForm('add');
     // assign in template
     $this->tpl->assign('defaultTemplateId', $defaultTemplateId);
     // create elements
     $this->frm->addText('title', null, null, 'form-control title', 'form-control danger title');
     $this->frm->addEditor('html');
     $this->frm->addHidden('template_id', $defaultTemplateId);
     $this->frm->addRadiobutton('hidden', array(array('label' => BL::lbl('Hidden'), 'value' => 'Y'), array('label' => BL::lbl('Published'), 'value' => 'N')), 'N');
     // image related fields
     $this->frm->addImage('image');
     // a god user should be able to adjust the detailed settings for a page easily
     if ($this->isGod) {
         // init some vars
         $items = array('move' => true, 'children' => true, 'edit' => true, 'delete' => true);
         $checked = array();
         $values = array();
         foreach ($items as $value => $itemIsChecked) {
             $values[] = array('label' => BL::msg(\SpoonFilter::toCamelCase('allow_' . $value)), 'value' => $value);
             if ($itemIsChecked) {
                 $checked[] = $value;
             }
         }
         $this->frm->addMultiCheckbox('allow', $values, $checked);
     }
     // build prototype block
     $block['index'] = 0;
     $block['formElements']['chkVisible'] = $this->frm->addCheckbox('block_visible_' . $block['index'], true);
     $block['formElements']['hidExtraId'] = $this->frm->addHidden('block_extra_id_' . $block['index'], 0);
     $block['formElements']['hidPosition'] = $this->frm->addHidden('block_position_' . $block['index'], 'fallback');
     $block['formElements']['txtHTML'] = $this->frm->addTextarea('block_html_' . $block['index']);
     // this is no editor; we'll add the editor in JS
     // add default block to "fallback" position, the only one which we can rest assured to exist
     $this->positions['fallback']['blocks'][] = $block;
     // content has been submitted: re-create submitted content rather than the db-fetched content
     if (isset($_POST['block_html_0'])) {
         // init vars
         $this->blocksContent = array();
         $hasBlock = false;
         $i = 1;
         // loop submitted blocks
         while (isset($_POST['block_position_' . $i])) {
             // init var
             $block = array();
             // save block position
             $block['position'] = $_POST['block_position_' . $i];
             $positions[$block['position']][] = $block;
             // set linked extra
             $block['extra_id'] = $_POST['block_extra_id_' . $i];
             // reset some stuff
             if ($block['extra_id'] <= 0) {
                 $block['extra_id'] = null;
             }
             // init html
             $block['html'] = null;
             // extra-type is HTML
             if ($block['extra_id'] === null) {
                 // reset vars
                 $block['extra_id'] = null;
                 $block['html'] = $_POST['block_html_' . $i];
             } else {
                 // type of block
                 if (isset($this->extras[$block['extra_id']]['type']) && $this->extras[$block['extra_id']]['type'] == 'block') {
                     // set error
                     if ($hasBlock) {
                         $this->frm->addError(BL::err('CantAdd2Blocks'));
                     }
                     // reset var
                     $hasBlock = true;
                 }
             }
             // set data
             $block['created_on'] = BackendModel::getUTCDate();
             $block['edited_on'] = $block['created_on'];
             $block['visible'] = isset($_POST['block_visible_' . $i]) && $_POST['block_visible_' . $i] == 'Y' ? 'Y' : 'N';
             $block['sequence'] = count($positions[$block['position']]) - 1;
             // add to blocks
             $this->blocksContent[] = $block;
             // increment counter; go fetch next block
             ++$i;
         }
     }
     // build blocks array
     foreach ($this->blocksContent as $i => $block) {
         $block['index'] = $i + 1;
         $block['formElements']['chkVisible'] = $this->frm->addCheckbox('block_visible_' . $block['index'], $block['visible'] == 'Y');
         $block['formElements']['hidExtraId'] = $this->frm->addHidden('block_extra_id_' . $block['index'], (int) $block['extra_id']);
         $block['formElements']['hidPosition'] = $this->frm->addHidden('block_position_' . $block['index'], $block['position']);
         $block['formElements']['txtHTML'] = $this->frm->addTextarea('block_html_' . $block['index'], $block['html']);
         // this is no editor; we'll add the editor in JS
         $this->positions[$block['position']]['blocks'][] = $block;
     }
     // redirect
//.........这里部分代码省略.........
开发者ID:forkcms,项目名称:forkcms,代码行数:101,代码来源:Add.php

示例13: setTooltip

 /**
  * Set a tooltip
  *
  * @param string $column  The name of the column to set the tooltop for.
  * @param string $message The key for the message (will be parsed through BackendLanguage::msg).
  */
 public function setTooltip($column, $message)
 {
     // get the column
     $instance = $this->getColumn($column);
     // build the value for the tooltip
     $value = BackendLanguage::msg($message);
     // reset the label
     $instance->setLabel($instance->getLabel() . '<abbr class="help">?</abbr><span class="tooltip hidden" style="display: none;">' . $value . '</span>');
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:15,代码来源:DataGrid.php

示例14: validateForm

 /**
  * Validates the form
  */
 private function validateForm()
 {
     // is the form submitted?
     if ($this->frm->isSubmitted()) {
         // validate required fields
         $this->frm->getField('mailer_from_name')->isFilled(BL::err('FieldIsRequired'));
         $this->frm->getField('mailer_from_email')->isEmail(BL::err('EmailIsInvalid'));
         $this->frm->getField('mailer_to_name')->isFilled(BL::err('FieldIsRequired'));
         $this->frm->getField('mailer_to_email')->isEmail(BL::err('EmailIsInvalid'));
         $this->frm->getField('mailer_reply_to_name')->isFilled(BL::err('FieldIsRequired'));
         $this->frm->getField('mailer_reply_to_email')->isEmail(BL::err('EmailIsInvalid'));
         if ($this->isGod) {
             // SMTP type was chosen
             if ($this->frm->getField('mailer_type')->getValue() == 'smtp') {
                 // server & port are required
                 $this->frm->getField('smtp_server')->isFilled(BL::err('FieldIsRequired'));
                 $this->frm->getField('smtp_port')->isFilled(BL::err('FieldIsRequired'));
             }
         }
         // no errors ?
         if ($this->frm->isCorrect()) {
             // e-mail settings
             $this->get('fork.settings')->set('Core', 'mailer_from', array('name' => $this->frm->getField('mailer_from_name')->getValue(), 'email' => $this->frm->getField('mailer_from_email')->getValue()));
             $this->get('fork.settings')->set('Core', 'mailer_to', array('name' => $this->frm->getField('mailer_to_name')->getValue(), 'email' => $this->frm->getField('mailer_to_email')->getValue()));
             $this->get('fork.settings')->set('Core', 'mailer_reply_to', array('name' => $this->frm->getField('mailer_reply_to_name')->getValue(), 'email' => $this->frm->getField('mailer_reply_to_email')->getValue()));
             if ($this->isGod) {
                 $this->get('fork.settings')->set('Core', 'mailer_type', $this->frm->getField('mailer_type')->getValue());
                 // smtp settings
                 $this->get('fork.settings')->set('Core', 'smtp_server', $this->frm->getField('smtp_server')->getValue());
                 $this->get('fork.settings')->set('Core', 'smtp_port', $this->frm->getField('smtp_port')->getValue());
                 $this->get('fork.settings')->set('Core', 'smtp_username', $this->frm->getField('smtp_username')->getValue());
                 $this->get('fork.settings')->set('Core', 'smtp_password', $this->frm->getField('smtp_password')->getValue());
                 $this->get('fork.settings')->set('Core', 'smtp_secure_layer', $this->frm->getField('smtp_secure_layer')->getValue());
             }
             // assign report
             $this->tpl->assign('report', true);
             $this->tpl->assign('reportMessage', BL::msg('Saved'));
         }
     }
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:43,代码来源:Email.php

示例15: loadDataGridTemplates

 /**
  * Load the data grid which contains the events.
  */
 private function loadDataGridTemplates()
 {
     // no hooks so don't bother
     if (!isset($this->information['templates'])) {
         return;
     }
     // build data for display in datagrid
     $templates = array();
     foreach ($this->information['templates'] as $template) {
         // set template name & path
         $record['name'] = $template['label'];
         $record['path'] = $template['path'];
         // set positions
         $record['positions'] = array();
         foreach ($template['positions'] as $position) {
             $record['positions'][] = $position['name'];
         }
         $record['positions'] = implode(', ', $record['positions']);
         // add template to list
         $templates[] = $record;
     }
     // create data grid
     $this->dataGridTemplates = new BackendDataGridArray($templates);
     // add label for path
     $this->dataGridTemplates->setHeaderLabels(array('path' => BL::msg('PathToTemplate')));
     // no paging
     $this->dataGridTemplates->setPaging(false);
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:31,代码来源:DetailTheme.php


注:本文中的Backend\Core\Language\Language::msg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。