本文整理汇总了PHP中BL::getLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP BL::getLabel方法的具体用法?PHP BL::getLabel怎么用?PHP BL::getLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BL
的用法示例。
在下文中一共展示了BL::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');
$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', SpoonLocale::getCountries(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: loadForm
/**
* Load the form
*/
private function loadForm()
{
$this->imageIsAllowed = BackendModel::getModuleSetting($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, 'inputText title', 'inputTextError title');
$this->frm->addEditor('text');
$this->frm->addEditor('introduction');
$this->frm->addRadiobutton('hidden', $rbtHiddenValues, 'N');
$this->frm->addCheckbox('allow_comments', BackendModel::getModuleSetting($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, 'inputText tagBox', 'inputTextError tagBox');
$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);
}
示例3: calculateTimeAgo
/**
* Calculate time ago.
*
* @return string
* @param int $timestamp Unix timestamp from the past.
*/
public static function calculateTimeAgo($timestamp)
{
// calculate difference
$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) {
return sprintf(BL::getLabel('MinutesAgo'), $minutes);
} elseif ($minutes == 1) {
return BL::getLabel('OneMinuteAgo');
} elseif ($seconds > 1) {
return sprintf(BL::getLabel('SecondsAgo'), $seconds);
} elseif ($seconds <= 1) {
return BL::getLabel('OneSecondAgo');
}
} elseif ($timestamp < $todayStart && $timestamp >= $todayStart - 86400) {
return BL::getLabel('Yesterday') . ' ' . date('H:i', $timestamp);
} else {
return date('d/m/Y H:i', $timestamp);
}
}
示例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: loadForm
/**
* Load the form
*
* @return void
*/
private function loadForm()
{
// create form
$this->frm = new BackendForm('edit');
// create elements
$this->frm->addText('name', $this->record['name']);
$this->frm->addDropdown('method', array('database' => BL::getLabel('MethodDatabase'), 'database_email' => BL::getLabel('MethodDatabaseEmail')), $this->record['method']);
$this->frm->addText('email', $this->record['email']);
$this->frm->addText('identifier', $this->record['identifier']);
$this->frm->addEditor('success_message', $this->record['success_message']);
// textfield dialog
$this->frm->addText('textbox_label');
$this->frm->addText('textbox_value');
$this->frm->addCheckbox('textbox_required');
$this->frm->addText('textbox_required_error_message');
$this->frm->addDropdown('textbox_validation', array('' => '', 'email' => BL::getLabel('Email'), 'numeric' => BL::getLabel('Numeric')));
$this->frm->addText('textbox_validation_parameter');
$this->frm->addText('textbox_error_message');
// textarea dialog
$this->frm->addText('textarea_label');
$this->frm->addTextarea('textarea_value');
$this->frm->getField('textarea_value')->setAttribute('cols', 30);
$this->frm->addCheckbox('textarea_required');
$this->frm->addText('textarea_required_error_message');
$this->frm->addDropdown('textarea_validation', array('' => ''));
$this->frm->addText('textarea_validation_parameter');
$this->frm->addText('textarea_error_message');
// dropdown dialog
$this->frm->addText('dropdown_label');
$this->frm->addText('dropdown_values');
$this->frm->addDropdown('dropdown_default_value', array('' => ''))->setAttribute('rel', 'dropDownValues');
$this->frm->addCheckbox('dropdown_required');
$this->frm->addText('dropdown_required_error_message');
// radiobutton dialog
$this->frm->addText('radiobutton_label');
$this->frm->addText('radiobutton_values');
$this->frm->addDropdown('radiobutton_default_value', array('' => ''))->setAttribute('rel', 'radioButtonValues');
$this->frm->addCheckbox('radiobutton_required');
$this->frm->addText('radiobutton_required_error_message');
// checkbox dialog
$this->frm->addText('checkbox_label');
$this->frm->addText('checkbox_values');
$this->frm->addDropdown('checkbox_default_value', array('' => ''))->setAttribute('rel', 'checkBoxValues');
$this->frm->addCheckbox('checkbox_required');
$this->frm->addText('checkbox_required_error_message');
// heading dialog
$this->frm->addText('heading');
// paragraph dialog
$this->frm->addTextarea('paragraph');
$this->frm->getField('paragraph')->setAttribute('cols', 30);
// submit dialog
$this->frm->addText('submit');
}
示例6: 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;
}
示例7: 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('BackendFormBuilderModel', 'formatRecipients'), array('[email]'), 'email');
$this->dataGrid->setColumnFunction(array('BackendFormBuilderModel', 'getLocale'), array('Method_[method]'), 'method');
$this->dataGrid->setColumnFunction(array('BackendFormBuilderIndex', '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'));
}
}
示例8: setClickableCount
/**
* Convert the count in a human readable one.
*
* @param int $count
* @param string $link
* @return string
*/
public static function setClickableCount($count, $link)
{
// redefine
$count = (int) $count;
$link = (string) $link;
// return link in case of more than one item, one item, other
if ($count > 1) {
return '<a href="' . $link . '">' . $count . ' ' . BL::getLabel('Questions') . '</a>';
}
if ($count == 1) {
return '<a href="' . $link . '">' . $count . ' ' . BL::getLabel('Question') . '</a>';
}
return '';
}
示例9: loadDataGrid
/**
* Load the datagrids
*
* @return void
*/
private function loadDataGrid()
{
// create datagrid
$this->dataGrid = new BackendDataGridDB(BackendFormBuilderModel::QRY_BROWSE, BL::getWorkingLanguage());
// set headers
$this->dataGrid->setHeaderLabels(array('email' => ucfirst(BL::getLabel('Recipient')), 'sent_forms' => ''));
// sorting columns
$this->dataGrid->setSortingColumns(array('name', 'email', 'method', 'sent_forms'), 'name');
// set colum URLs
$this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('edit') . '&id=[id]');
// set method label
$this->dataGrid->setColumnFunction(array('BackendFormBuilderModel', 'getLocale'), array('Method_[method]'), 'method');
// set the amount of sent forms
$this->dataGrid->setColumnFunction(array('BackendFormBuilderIndex', 'parseNumForms'), array('[id]', '[sent_forms]'), 'sent_forms');
// add edit column
$this->dataGrid->addColumn('edit', null, BL::getLabel('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::getLabel('Edit'));
}
示例10: 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('detail_module')) {
$this->dataGridInstallableModules->setColumnURL('raw_name', BackendModel::createURLForAction('detail_module') . '&module=[raw_name]');
$this->dataGridInstallableModules->addColumn('details', null, BL::lbl('Details'), BackendModel::createURLForAction('detail_module') . '&module=[raw_name]', BL::lbl('Details'));
}
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('install_module')) {
// add install column
$this->dataGridInstallableModules->addColumn('install', null, BL::lbl('Install'), BackendModel::createURLForAction('install_module') . '&module=[raw_name]', BL::lbl('Install'));
$this->dataGridInstallableModules->setColumnConfirm('install', sprintf(BL::msg('ConfirmModuleInstall'), '[raw_name]'), null, SpoonFilter::ucfirst(BL::lbl('Install')) . '?');
}
}
示例11: 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()
{
// get installed modules
$installedModules = (array) BackendModel::getDB()->getRecords('SELECT name FROM modules', null, 'name');
// get modules present on the filesystem
$modules = SpoonDirectory::getList(BACKEND_MODULES_PATH, false, null, '/^[a-zA-Z0-9_]+$/');
// all modules that are managable in the backend
$managableModules = array();
// get more information for each module
foreach ($modules as $moduleName) {
// skip ignored modules
if (in_array($moduleName, self::$ignoredModules)) {
continue;
}
// init module information
$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;
// the module is present in the database, that means its installed
if (isset($installedModules[$moduleName])) {
$module['installed'] = true;
}
// get extra info from the info.xml
try {
$infoXml = @new SimpleXMLElement(BACKEND_MODULES_PATH . '/' . $module['raw_name'] . '/info.xml', LIBXML_NOCDATA, true);
// process XML to a clean array
$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'])) {
// go search whether or not all or active
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
}
// add to list of managable modules
$managableModules[] = $module;
}
return $managableModules;
}
示例12: parseNumProfiles
/**
* Parse amount of profiles for the datagrid.
*
* @return string
* @param int $groupId Group id.
* @param int $numProfiles Number of profiles.
*/
public static function parseNumProfiles($groupId, $numProfiles)
{
// 1 item
if ($numProfiles == 1) {
$output = '1 ' . BL::getLabel('Profile');
} else {
$output = $numProfiles . ' ' . BL::getLabel('Profiles');
}
// complete output
return '<a href="' . BackendModel::createURLForAction('index') . '&group=' . $groupId . '" title="' . $output . '">' . $output . '</a>';
}
示例13: 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('data_details')) {
// set colum URLs
$this->dataGrid->setColumnURL('sent_on', BackendModel::createURLForAction('data_details', 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('data_details', 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('BackendFormBuilderModel', 'calculateTimeAgo'), '[sent_on]', 'sent_on', false);
$this->dataGrid->setColumnFunction('ucfirst', '[sent_on]', 'sent_on', false);
// add the multicheckbox column
$this->dataGrid->setMassActionCheckboxes('checkbox', '[id]');
// mass action
$ddmMassAction = new SpoonFormDropdown('action', array('delete' => BL::getLabel('Delete')), 'delete');
$ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDelete'));
$this->dataGrid->setMassAction($ddmMassAction);
}
示例14: loadDataGrid
/**
* Load the datagrid
*
* @return void
*/
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 URLs
$this->dgProfiles->setColumnURL('email', BackendModel::createURLForAction('edit') . '&id=[id]');
// set column function
$this->dgProfiles->setColumnFunction(array('BackendDataGridFunctions', 'getLongDate'), array('[registered_on]'), 'registered_on', true);
// add columns
$this->dgProfiles->addColumn('edit', null, BL::getLabel('Edit'), BackendModel::createURLForAction('edit', null, null, null) . '&id=[id]', BL::getLabel('Edit'));
// add the mass action controls
$this->dgProfiles->setMassActionCheckboxes('checkbox', '[id]');
$ddmMassAction = new SpoonFormDropdown('action', array('addToGroup' => BL::getLabel('AddToGroup'), 'delete' => BL::getLabel('Delete')), 'addToGroup');
$ddmMassAction->setAttribute('id', 'massAction');
$ddmMassAction->setOptionAttributes('addToGroup', array('data-message-id' => 'confirmAddToGroup'));
$ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDelete'));
$this->dgProfiles->setMassAction($ddmMassAction);
}
示例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, 'inputText title', 'inputTextError 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, 'inputText tagBox', 'inputTextError tagBox');
$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('BackendBlogModel', 'getURL', array($this->record['id']));
}