本文整理汇总了PHP中Backend\Core\Language\Language::getLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::getLabel方法的具体用法?PHP Language::getLabel怎么用?PHP Language::getLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Backend\Core\Language\Language
的用法示例。
在下文中一共展示了Language::getLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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('');
}
示例2: calculateTimeAgo
/**
* Calculate time ago.
*
* @param int $timestamp Unix timestamp from the past.
*
* @return string
*/
public static function calculateTimeAgo($timestamp)
{
$secondsBetween = time() - $timestamp;
// calculate
$hours = floor($secondsBetween / (60 * 60));
$minutes = floor($secondsBetween / 60);
$seconds = floor($secondsBetween);
// today start
$todayStart = (int) strtotime(date('d F Y'));
// today
if ($timestamp >= $todayStart) {
// today
if ($hours >= 1) {
return BL::getLabel('Today') . ' ' . date('H:i', $timestamp);
} elseif ($minutes > 1) {
// more than one minute
return sprintf(BL::getLabel('MinutesAgo'), $minutes);
} elseif ($minutes == 1) {
// one minute
return BL::getLabel('OneMinuteAgo');
} elseif ($seconds > 1) {
// more than one second
return sprintf(BL::getLabel('SecondsAgo'), $seconds);
} elseif ($seconds <= 1) {
// one second
return BL::getLabel('OneSecondAgo');
}
} elseif ($timestamp < $todayStart && $timestamp >= $todayStart - 86400) {
// yesterday
return BL::getLabel('Yesterday') . ' ' . date('H:i', $timestamp);
} else {
// older
return date('d/m/Y H:i', $timestamp);
}
}
示例3: loadForm
/**
* Load the form
*/
private function loadForm()
{
$this->imageIsAllowed = $this->get('fork.settings')->get($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, 'form-control title', 'form-control danger title');
$this->frm->addEditor('text');
$this->frm->addEditor('introduction');
$this->frm->addRadiobutton('hidden', $rbtHiddenValues, 'N');
$this->frm->addCheckbox('allow_comments', $this->get('fork.settings')->get($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, 'form-control js-tags-input', 'form-control danger js-tags-input');
$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);
}
示例4: loadForm
/**
* Load the form
*/
private function loadForm()
{
$this->frm = new BackendForm('add');
$this->frm->addText('name');
$this->frm->addDropdown('method', array('database' => BL::getLabel('MethodDatabase'), 'database_email' => BL::getLabel('MethodDatabaseEmail')), 'database_email');
$this->frm->addText('email');
$this->frm->addText('identifier', BackendFormBuilderModel::createIdentifier());
$this->frm->addEditor('success_message');
}
示例5: setClickableCount
/**
* Convert the count in a human readable one.
*
* @param int $count The count.
* @param string $link The link for the count.
*
* @return string
*/
public static function setClickableCount($count, $link)
{
$count = (int) $count;
$link = (string) $link;
$return = '';
if ($count > 1) {
$return = '<a href="' . $link . '">' . $count . ' ' . BL::getLabel('Articles') . '</a>';
} elseif ($count == 1) {
$return = '<a href="' . $link . '">' . $count . ' ' . BL::getLabel('Article') . '</a>';
}
return $return;
}
示例6: loadDataGrid
/**
* Load the datagrids
*/
private function loadDataGrid()
{
$this->dataGrid = new BackendDataGridDB(BackendFormBuilderModel::QRY_BROWSE, BL::getWorkingLanguage());
$this->dataGrid->setHeaderLabels(array('email' => \SpoonFilter::ucfirst(BL::getLabel('Recipient')), 'sent_forms' => ''));
$this->dataGrid->setSortingColumns(array('name', 'email', 'method', 'sent_forms'), 'name');
$this->dataGrid->setColumnFunction(array(new BackendFormBuilderModel(), 'formatRecipients'), array('[email]'), 'email');
$this->dataGrid->setColumnFunction(array(new BackendFormBuilderModel(), 'getLocale'), array('Method_[method]'), 'method');
$this->dataGrid->setColumnFunction(array(__CLASS__, 'parseNumForms'), array('[id]', '[sent_forms]'), 'sent_forms');
// check if edit action is allowed
if (BackendAuthentication::isAllowedAction('Edit')) {
$this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('Edit') . '&id=[id]');
$this->dataGrid->addColumn('edit', null, BL::getLabel('Edit'), BackendModel::createURLForAction('Edit') . '&id=[id]', BL::getLabel('Edit'));
}
}
示例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') . '&module=[raw_name]');
$this->dataGridInstallableModules->addColumn('details', null, BL::lbl('Details'), BackendModel::createURLForAction('DetailModule') . '&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') . '&module=[raw_name]', BL::lbl('Install'));
$this->dataGridInstallableModules->setColumnConfirm('install', sprintf(BL::msg('ConfirmModuleInstall'), '[raw_name]'), null, \SpoonFilter::ucfirst(BL::lbl('Install')) . '?');
}
}
示例8: getModules
/**
* Get modules based on the directory listing in the backend application.
*
* If a module contains a info.xml it will be parsed.
*
* @return array
*/
public static function getModules()
{
$installedModules = (array) BackendModel::getContainer()->getParameter('installed_modules');
$modules = BackendModel::getModulesOnFilesystem(false);
$manageableModules = array();
// get more information for each module
foreach ($modules as $moduleName) {
if (in_array($moduleName, self::$ignoredModules)) {
continue;
}
$module = array();
$module['id'] = 'module_' . $moduleName;
$module['raw_name'] = $moduleName;
$module['name'] = \SpoonFilter::ucfirst(BL::getLabel(\SpoonFilter::toCamelCase($moduleName)));
$module['description'] = '';
$module['version'] = '';
$module['installed'] = false;
$module['cronjobs_active'] = true;
if (in_array($moduleName, $installedModules)) {
$module['installed'] = true;
}
try {
$infoXml = @new \SimpleXMLElement(BACKEND_MODULES_PATH . '/' . $module['raw_name'] . '/info.xml', LIBXML_NOCDATA, true);
$info = self::processModuleXml($infoXml);
// set fields if they were found in the XML
if (isset($info['description'])) {
$module['description'] = BackendDataGridFunctions::truncate($info['description'], 80);
}
if (isset($info['version'])) {
$module['version'] = $info['version'];
}
// check if cronjobs are set
if (isset($info['cronjobs'])) {
foreach ($info['cronjobs'] as $cronjob) {
if (!$cronjob['active']) {
$module['cronjobs_active'] = false;
break;
}
}
}
} catch (\Exception $e) {
// don't act upon error, we simply won't possess some info
}
$manageableModules[] = $module;
}
return $manageableModules;
}
示例9: getLabel
/**
* Get a label from the language-file
*
* @param string $key The key to get.
* @param string $module The module wherein we should search.
*
* @deprecated
*
* @return string
*/
public static function getLabel($key, $module = null)
{
trigger_error('Backend\\Core\\Engine\\Language is deprecated.
It has been moved to Backend\\Core\\Language\\Language', E_USER_DEPRECATED);
return parent::getLabel($key, $module);
}
示例10: getStatusForDropDown
/**
* Fetch the list of status, but for a dropdown.
*
* @return array
*/
public static function getStatusForDropDown()
{
// fetch types
$status = BackendModel::getContainer()->get('database')->getEnumValues('profiles', 'status');
// init
$labels = $status;
// loop and build labels
foreach ($labels as &$row) {
$row = \SpoonFilter::ucfirst(BL::getLabel(\SpoonFilter::ucfirst($row)));
}
// build array
return array_combine($status, $labels);
}
示例11: loadDataGrid
/**
* Load the datagrids
*/
private function loadDataGrid()
{
list($query, $parameters) = $this->buildQuery();
// create datagrid
$this->dataGrid = new BackendDataGridDB($query, $parameters);
// overrule default URL
$this->dataGrid->setURL(BackendModel::createURLForAction(null, null, null, array('offset' => '[offset]', 'order' => '[order]', 'sort' => '[sort]', 'start_date' => $this->filter['start_date'], 'end_date' => $this->filter['end_date']), false) . '&id=' . $this->id);
// sorting columns
$this->dataGrid->setSortingColumns(array('sent_on'), 'sent_on');
$this->dataGrid->setSortParameter('desc');
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('DataDetails')) {
// set colum URLs
$this->dataGrid->setColumnURL('sent_on', BackendModel::createURLForAction('DataDetails', null, null, array('start_date' => $this->filter['start_date'], 'end_date' => $this->filter['end_date']), false) . '&id=[id]');
// add edit column
$this->dataGrid->addColumn('details', null, BL::getLabel('Details'), BackendModel::createURLForAction('DataDetails', null, null, array('start_date' => $this->filter['start_date'], 'end_date' => $this->filter['end_date'])) . '&id=[id]', BL::getLabel('Details'));
}
// date
$this->dataGrid->setColumnFunction(array(new BackendFormBuilderModel(), 'calculateTimeAgo'), '[sent_on]', 'sent_on', false);
$this->dataGrid->setColumnFunction('ucfirst', '[sent_on]', 'sent_on', false);
// add the multicheckbox column
$this->dataGrid->setMassActionCheckboxes('check', '[id]');
// mass action
$ddmMassAction = new \SpoonFormDropdown('action', array('delete' => BL::getLabel('Delete')), 'delete');
$ddmMassAction->setOptionAttributes('delete', array('data-target' => '#confirmDelete'));
$this->dataGrid->setMassAction($ddmMassAction);
}
示例12: lbl
/**
* @param $label string
*
* @return string
*/
private function lbl($label)
{
return ucfirst(BackendLanguage::getLabel($label));
}
示例13: parse
/**
* Parse the header into the template
*/
public function parse()
{
// put the page title in the <title>
$this->tpl->assign('page_title', BL::getLabel($this->URL->getModule()));
// parse CSS
$this->parseCSS();
// parse JS
$this->parseJS();
}
示例14: loadDataGrid
/**
* Load the datagrid
*/
private function loadDataGrid()
{
// fetch query and parameters
list($query, $parameters) = $this->buildQuery();
// create datagrid
$this->dgProfiles = new BackendDataGridDB($query, $parameters);
// overrule default URL
$this->dgProfiles->setURL(BackendModel::createURLForAction(null, null, null, array('offset' => '[offset]', 'order' => '[order]', 'sort' => '[sort]', 'email' => $this->filter['email'], 'status' => $this->filter['status'], 'group' => $this->filter['group']), false));
// sorting columns
$this->dgProfiles->setSortingColumns(array('email', 'display_name', 'status', 'registered_on'), 'email');
// set column function
$this->dgProfiles->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[registered_on]'), 'registered_on', true);
// add the mass action controls
$this->dgProfiles->setMassActionCheckboxes('check', '[id]');
$ddmMassAction = new \SpoonFormDropdown('action', array('addToGroup' => BL::getLabel('AddToGroup'), 'delete' => BL::getLabel('Delete')), 'addToGroup', false, 'form-control', 'form-control danger');
$ddmMassAction->setAttribute('id', 'massAction');
$ddmMassAction->setOptionAttributes('addToGroup', array('data-target' => '#confirmAddToGroup'));
$ddmMassAction->setOptionAttributes('delete', array('data-target' => '#confirmDelete'));
$this->dgProfiles->setMassAction($ddmMassAction);
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('Edit')) {
// set column URLs
$this->dgProfiles->setColumnURL('email', BackendModel::createURLForAction('Edit') . '&id=[id]');
// add columns
$this->dgProfiles->addColumn('edit', null, BL::getLabel('Edit'), BackendModel::createURLForAction('Edit', null, null, null) . '&id=[id]', BL::getLabel('Edit'));
}
}
示例15: loadForm
/**
* Load the form
*/
private function loadForm()
{
// create form
$this->frm = new BackendForm('edit');
// set hidden values
$rbtHiddenValues[] = array('label' => BL::lbl('Hidden'), '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', $this->record['title'], null, 'form-control title', 'form-control danger title');
$this->frm->addEditor('text', $this->record['text']);
$this->frm->addEditor('introduction', $this->record['introduction']);
$this->frm->addRadiobutton('hidden', $rbtHiddenValues, $this->record['hidden']);
$this->frm->addCheckbox('allow_comments', $this->record['allow_comments'] === 'Y' ? true : false);
$this->frm->addDropdown('category_id', $categories, $this->record['category_id']);
if (count($categories) != 2) {
$this->frm->getField('category_id')->setDefaultElement('');
}
$this->frm->addDropdown('user_id', BackendUsersModel::getUsers(), $this->record['user_id']);
$this->frm->addText('tags', BackendTagsModel::getTags($this->URL->getModule(), $this->record['id']), null, 'form-control js-tags-input', 'form-control danger js-tags-input');
$this->frm->addDate('publish_on_date', $this->record['publish_on']);
$this->frm->addTime('publish_on_time', date('H:i', $this->record['publish_on']));
if ($this->imageIsAllowed) {
$this->frm->addImage('image');
$this->frm->addCheckbox('delete_image');
}
// meta object
$this->meta = new BackendMeta($this->frm, $this->record['meta_id'], 'title', true);
// set callback for generating a unique URL
$this->meta->setURLCallback('Backend\\Modules\\Blog\\Engine\\Model', 'getURL', array($this->record['id']));
}