本文整理汇总了PHP中QApplication::HasPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP QApplication::HasPermission方法的具体用法?PHP QApplication::HasPermission怎么用?PHP QApplication::HasPermission使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QApplication
的用法示例。
在下文中一共展示了QApplication::HasPermission方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Form_Create
protected function Form_Create()
{
parent::Form_Create();
$this->pnlTab = new QTabs($this);
/**
* Create the project list panel and set the filter from the url.
* The filter is used to show only projects of a given status based on their progress
* (finished, empty, in progress).
*/
$this->pnlProjectList = new NarroProjectListPanel($this->pnlTab);
$this->pnlTop = new NarroTopPanel(date(sprintf('Y-m-%d 00:00:00', date('d') - date('N') + 1)), $this);
$pnlDummy = new QPanel($this->pnlTab);
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders = array(t('Projects'), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate')), NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Review')));
/**
* Do not show the langauge tab if only two languages are active (source and target
* Unless the user is an administrator and might want to set another one active
*/
if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::LanguageList(t('Languages'));
}
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::UserList('', t('Users'));
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
if (QApplication::HasPermissionForThisLang('Administrator')) {
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::Log('', t('Application Log'));
}
$this->pnlTab->Headers = $arrHeaders;
}
示例2: Form_Create
protected function Form_Create()
{
parent::Form_Create();
$this->pnlTab = new QTabs($this);
$pnlDummy = new QPanel($this->pnlTab);
$pnlDummy = new QPanel($this->pnlTab);
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders = array(NarroLink::ProjectList(t('Projects')), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_ALL, '', 0, 0, 10, 0, 0, t('Translate')), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Review')));
/**
* Do not show the langauge tab if only two languages are active (source and target
* Unless the user is an administrator and might want to set another one active
*/
if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
$this->pnlLanguageTab = new QTabs($this->pnlTab);
$pnlDummy = new QPanel($this->pnlLanguageTab);
$arrLangHeaders[] = t('List');
if (QApplication::HasPermissionForThisLang('Can add language')) {
$this->pnlLanguageEdit = new NarroLanguageEditPanel($this->pnlLanguageTab, NarroLanguage::Load(QApplication::QueryString('lid')));
$arrLangHeaders[] = QApplication::QueryString('lid') ? t('Edit') : t('Add');
}
$this->pnlLanguageTab->Headers = $arrLangHeaders;
$this->pnlLanguageTab->Selected = 1;
$arrHeaders[] = t('Languages');
$this->pnlTab->Selected = count($arrHeaders) - 1;
}
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::UserList('', t('Users'));
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
if (QApplication::HasPermissionForThisLang('Administrator')) {
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::Log('', t('Application Log'));
}
$this->pnlTab->Headers = $arrHeaders;
}
示例3: Form_Create
protected function Form_Create()
{
parent::Form_Create();
$this->pnlTab = new QTabs($this);
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::ProjectList(t('Projects'));
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Translate'));
if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::LanguageList(t('Languages'));
}
$this->pnlUserList = new NarroUserListPanel($this->pnlTab);
$arrHeaders[] = NarroLink::UserList('', t('Users'));
$this->pnlTab->Selected = count($arrHeaders) - 1;
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
if (QApplication::HasPermissionForThisLang('Administrator')) {
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::Log('', t('Application Log'));
}
$this->pnlTab->Headers = $arrHeaders;
}
示例4: dtgRoleUserList_UsernameColumn_Render
public function dtgRoleUserList_UsernameColumn_Render(NarroUserRole $objNarroUserRole)
{
if (QApplication::HasPermission('Can manage roles')) {
return NarroLink::UserRole($objNarroUserRole->UserId, $objNarroUserRole->User->Username);
} else {
return NarroLink::UserProfile($objNarroUserRole->UserId, $objNarroUserRole->User->Username);
}
}
示例5: GetControlHtml
protected function GetControlHtml()
{
$strOutput = $this->lblMessage->Render(false) . '<br /><table style="border: 1px solid #DDDDDD" cellpadding="4" cellspacing="0" width="100%">';
foreach (NarroProject::$AvailablePreferences as $strName => $arrPref) {
if ($arrPref['project_type'] && $arrPref['project_type'] != $this->objProject->ProjectType) {
continue;
}
$this->lblMessage->Text = t('Here you can set your project preferences.');
switch ($arrPref['type']) {
case 'number':
$txtNumber = new QIntegerTextBox($this);
$txtNumber->Name = $strName;
$txtNumber->Minimum = 5;
$txtNumber->Maximum = 100;
$txtNumber->MaxLength = 3;
$txtNumber->Width = 50;
if ($arrPref['global']) {
$txtNumber->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId);
}
$txtNumber->Text = $this->objProject->GetPreferenceValueByName($strName);
$strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtNumber->RenderWithError(false), $arrPref['description'] ? t($arrPref['description']) : '');
$this->arrControls[$strName] = $txtNumber;
break;
case 'text':
$txtTextPref = new QTextBox($this);
$txtTextPref->Name = $strName;
if ($arrPref['global']) {
$txtTextPref->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId);
}
$txtTextPref->Text = $this->objProject->GetPreferenceValueByName($strName);
$txtTextPref->Columns = strlen($txtTextPref->Text);
$strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtTextPref->RenderWithError(false), $arrPref['description'] ? t($arrPref['description']) : '');
$this->arrControls[$strName] = $txtTextPref;
break;
case 'option':
$lstOption = new QListBox($this);
$lstOption->Name = $strName;
if ($arrPref['global']) {
$lstOption->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId);
}
foreach ($arrPref['values'] as $strValue) {
$lstOption->AddItem(t($strValue), $strValue, $strValue == $this->objProject->GetPreferenceValueByName($strName));
}
$strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $lstOption->RenderWithError(false), $arrPref['description'] ? t($arrPref['description']) : '');
$this->arrControls[$strName] = $lstOption;
break;
}
}
$strOutput .= '</table><br />';
$this->strText = $strOutput;
return parent::GetControlHtml();
}
示例6: Form_Create
protected function Form_Create()
{
parent::Form_Create();
if (QApplication::QueryString('p') == 0) {
$this->pnlMainTab = new QTabs($this);
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::ProjectList(t('Projects'));
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Translate'));
$this->pnlReview = new NarroTranslatePanel($this->pnlMainTab);
$arrHeaders[] = t('Review');
$this->pnlMainTab->Selected = count($arrHeaders) - 1;
if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::LanguageList(t('Languages'));
}
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::UserList('', t('Users'));
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
if (QApplication::HasPermissionForThisLang('Administrator')) {
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::Log('', t('Application Log'));
}
$this->pnlMainTab->Headers = $arrHeaders;
} else {
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::Project($this->objProject->ProjectId, t('Overview'));
if ($this->objProject instanceof NarroProject && QApplication::HasPermissionForThisLang('Can edit project', $this->objProject->ProjectId)) {
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::ProjectEdit($this->objProject->ProjectId, t('Edit'));
}
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::Translate($this->objProject->ProjectId, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
$this->pnlReview = new NarroTranslatePanel($this->pnlMainTab);
$arrHeaders[] = t('Review');
$this->pnlMainTab->Selected = count($arrHeaders) - 1;
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::ProjectFileList($this->objProject->ProjectId, '', '', t('Files'));
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::ProjectLanguages($this->objProject->ProjectId, t('Languages'));
if (QApplication::HasPermissionForThisLang('Can import project', $this->objProject->ProjectId)) {
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::ProjectImport($this->objProject->ProjectId, t('Import'));
}
if (QApplication::HasPermissionForThisLang('Can export project', $this->objProject->ProjectId)) {
$pnlDummy = new QPanel($this->pnlMainTab);
$arrHeaders[] = NarroLink::ProjectExport($this->objProject->ProjectId, t('Export'));
}
$this->pnlMainTab->Headers = $arrHeaders;
}
}
示例7: Form_Create
protected function Form_Create()
{
parent::Form_Create();
$this->pnlTab = new QTabPanel($this);
$this->pnlTab->UseAjax = false;
$this->pnlRoleTab = new QTabPanel($this->pnlTab);
$this->pnlRoleEdit = new NarroRoleEditPanel($this->pnlRoleTab, NarroRole::Load(QApplication::QueryString('rid')));
$this->pnlRoleTab->addTab(new QPanel($this->pnlRoleTab), t('List'), NarroLink::RoleList());
$this->pnlRoleTab->addTab($this->pnlRoleEdit, QApplication::QueryString('lid') ? t('Edit') : t('Add'));
$this->pnlTab->addTab(new QPanel($this->pnlTab), t('Projects'), NarroLink::ProjectList());
$this->pnlTab->addTab(new QPanel($this->pnlTab), t('Translate'), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_ALL, '', 0, 0, 10, 0, 0));
$this->pnlTab->addTab(new QPanel($this->pnlTab), t('Languages'), NarroLink::LanguageList());
$this->pnlTab->addTab(new QPanel($this->pnlTab), t('Users'), NarroLink::UserList());
$this->pnlTab->addTab($this->pnlRoleTab, t('Roles'));
$this->pnlTab->SelectedTab = 4;
$this->pnlRoleTab->SelectedTab = 1;
$this->pnlTab = new QTabs($this);
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::ProjectList(t('Projects'));
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Translate'));
if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::LanguageList(t('Languages'));
}
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::UserList('', t('Users'));
$this->pnlRoleTab = new QTabs($this->pnlTab);
new QPanel($this->pnlRoleTab);
$arrRoleHeaders[] = NarroLink::RoleList(0, '', t('List'));
if (QApplication::HasPermissionForThisLang('Can add role')) {
$pnlDummy = new NarroRoleEditPanel($this->pnlRoleTab, NarroRole::Load(QApplication::QueryString('rid')));
$arrRoleHeaders[] = NarroLink::RoleEdit(null, t('Add'));
$this->pnlRoleTab->Selected = count($arrRoleHeaders) - 1;
}
$this->pnlRoleTab->Headers = $arrRoleHeaders;
$arrHeaders[] = t('Roles');
$this->pnlTab->Selected = count($arrHeaders) - 1;
if (QApplication::HasPermissionForThisLang('Administrator')) {
$pnlDummy = new QPanel($this->pnlTab);
$arrHeaders[] = NarroLink::Log('', t('Application Log'));
}
$this->pnlTab->Headers = $arrHeaders;
}
示例8: btnDelete_Click
public function btnDelete_Click($strFormId, $strControlId, $strParameter)
{
if (!QApplication::HasPermission('Can delete project', $this->objProject->ProjectId)) {
QApplication::Redirect(NarroLink::ProjectList());
}
$objDatabase = QApplication::$Database[1];
try {
$strQuery = sprintf("DELETE FROM narro_context_info USING narro_context_info LEFT JOIN narro_context ON narro_context_info.context_id=narro_context.context_id WHERE narro_context_info.language_id=%d AND narro_context.project_id=%d", QApplication::GetLanguageId(), $this->objProject->ProjectId);
$objDatabase->NonQuery($strQuery);
$strQuery = sprintf("DELETE FROM `narro_context` WHERE project_id = %d", $this->objProject->ProjectId);
$objDatabase->NonQuery($strQuery);
$strQuery = sprintf("DELETE FROM `narro_file` WHERE project_id = %d", $this->objProject->ProjectId);
$objDatabase->NonQuery($strQuery);
$strQuery = sprintf("DELETE FROM `narro_user_role` WHERE project_id = %d", $this->objProject->ProjectId);
$objDatabase->NonQuery($strQuery);
$intProjectId = $this->objProject->ProjectId;
$this->objProject->Delete();
NarroUtils::RecursiveDelete(__IMPORT_PATH__ . '/' . $intProjectId);
NarroUtils::RecursiveDelete(sprintf('%s/project-%d-hg', __NARRO_DATA__ . '/mozilla-build', $intProjectId));
NarroUtils::RecursiveDelete(sprintf('%s/project-%d-obj', __NARRO_DATA__ . '/mozilla-build', $intProjectId));
} catch (Exception $objEx) {
$this->lblMessage->Text = $objEx->getMessage();
return false;
}
QApplication::Redirect(NarroLink::ProjectList());
}
示例9: dtgRole_Actions_Render
public function dtgRole_Actions_Render(NarroRole $objNarroRole)
{
$strControlId = 'btnEditRole' . $objNarroRole->RoleId;
$btnEdit = $this->Form->GetControl($strControlId);
if (!$btnEdit) {
$btnEdit = new QButton($this->dtgRole, $strControlId);
$btnEdit->Text = t('Edit');
if (QApplication::$UseAjax) {
$btnEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEditRole_Click'));
} else {
$btnEdit->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnEditRole_Click'));
}
}
$btnEdit->ActionParameter = $objNarroRole->RoleId;
$btnEdit->Display = QApplication::HasPermission('Can manage user roles');
$strControlId = 'btnDeleteRole' . $objNarroRole->RoleId;
$btnDelete = $this->Form->GetControl($strControlId);
if (!$btnDelete) {
$btnDelete = new QButton($this->dtgRole, $strControlId);
$btnDelete->Text = t('Delete');
$btnDelete->AddAction(new QClickEvent(), new QConfirmAction(t('Are you sure you want to delete this role?')));
if (QApplication::$UseAjax) {
$btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDeleteRole_Click'));
} else {
$btnDelete->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnDeleteRole_Click'));
}
}
$btnDelete->ActionParameter = $objNarroRole->RoleId;
$btnDelete->Display = QApplication::HasPermission('Can manage user roles');
$strControlId = 'btnPermissions' . $objNarroRole->RoleId;
$btnPermissions = $this->Form->GetControl($strControlId);
if (!$btnPermissions) {
$btnPermissions = new QButton($this->dtgRole, $strControlId);
$btnPermissions->Text = t('Permissions');
$btnPermissions->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnPermissions_Click'));
}
$btnPermissions->ActionParameter = $objNarroRole->RoleId;
$strControlId = 'btnViewUsers' . $objNarroRole->RoleId;
$btnViewUsers = $this->Form->GetControl($strControlId);
if (!$btnViewUsers) {
$btnViewUsers = new QButton($this->dtgRole, $strControlId);
$btnViewUsers->Text = t('View users');
$btnViewUsers->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnViewUsers_Click'));
}
$btnViewUsers->ActionParameter = $objNarroRole->RoleId;
$strOutput = '';
if ($objNarroRole->RoleId > 5) {
$strOutput .= $btnEdit->Render(false) . ' ' . $btnDelete->Render(false) . ' ';
}
$strOutput .= $btnPermissions->Render(false) . ' ' . $btnViewUsers->Render(false);
return $strOutput;
}
示例10: __set
public function __set($strName, $mixValue)
{
$this->blnModified = true;
switch ($strName) {
// APPEARANCE
case "Role":
$this->objRole = $mixValue;
if (!QApplication::HasPermission('Can manage roles')) {
$this->dtgPermission->AdditionalConditions = QQ::Equal(QQN::NarroPermission()->NarroRolePermissionAsPermission->RoleId, $this->objRole->RoleId);
}
$this->dtgPermission->MarkAsModified();
break;
default:
try {
return parent::__set($strName, $mixValue);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
break;
}
}
示例11: t
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
echo t('This is a list of languages that projects can be translated in.');
?>
<span style="text-align:right;display:block;white-space:nowrap;">
<?php
if (QApplication::HasPermission('Can edit language', null)) {
?>
<label for="<?php
echo $_CONTROL->lstFilter->ControlId;
?>
"><?php
_t('Show');
?>
:</label>
<?php
$_CONTROL->lstFilter->Render();
}
$_CONTROL->txtSearch->Render();
$_CONTROL->btnSearch->Render();
?>
</span>
示例12: btnDelete_Click
public function btnDelete_Click($strFormId, $strControlId, $strParameter)
{
if (QApplication::HasPermission('Can manage users')) {
$this->objNarroUser->Delete();
QApplication::Redirect(NarroLink::UserList(''));
}
}
示例13: dtgFile_colSettings_Render
public function dtgFile_colSettings_Render(NarroFileProgress $objProgress)
{
if ($objProgress->File->TypeId == NarroFileType::Folder) {
return '';
}
$strControlId = 'chkExport' . $objProgress->FileId;
$chkExport = $this->dtgFile->GetChildControl($strControlId);
if (!$chkExport) {
$chkExport = new QCheckBox($this->dtgFile, $strControlId);
$chkExport->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'chkExport_Click'));
$chkExport->Name = t('Export with project');
$chkExport->ToolTip = t('If ticked, this file will be exported when doing a project export. Useful for excluding some files from the project export.');
}
$chkExport->ActionParameter = $objProgress->File->FileId;
$chkExport->Checked = NarroFileProgress::CountByFileIdLanguageIdExport($objProgress->File->FileId, QApplication::GetLanguageId(), 1);
$chkExport->Display = QApplication::HasPermission('Can export project', $this->objProject->ProjectId, QApplication::GetLanguageId());
return $chkExport->RenderWithName(false);
}
示例14: txtSearch_Autocomplete
public function txtSearch_Autocomplete()
{
$arrReturn = array();
$arrConditions = array(QQ::Like(QQN::NarroProject()->ProjectName, '%' . $this->txtSearch->Text . '%'));
if (!QApplication::HasPermission('Administrator')) {
$arrConditions[] = QQ::Equal(QQN::NarroProject()->Active, true);
}
foreach (NarroProject::QueryArray(QQ::AndCondition($arrConditions), array(QQ::LimitInfo(10, 0))) as $objProject) {
$arrReturn[] = $objProject->ProjectName;
}
$this->txtSearch->DataSource = $arrReturn;
}
示例15: __construct
public function __construct($objParentObject, $strControlId = null)
{
// Call the Parent
try {
parent::__construct($objParentObject, $strControlId);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
$this->strTemplate = __NARRO_INCLUDES__ . '/narro/panel/NarroLanguageListPanel.tpl.php';
// Setup DataGrid Columns
$this->colLanguageName = new QDataGridColumn(t('Language Name'), '<?= $_CONTROL->ParentControl->dtgLanguage_LanguageNameColumn_Render($_ITEM) ?>', array('OrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->LanguageName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->LanguageName, false)));
$this->colLanguageName->HtmlEntities = false;
$this->colLanguageCode = new QDataGridColumn(t('Language Code'), '<?= $_CONTROL->ParentControl->dtgLanguage_LanguageCodeColumn_Render($_ITEM) ?>', array('OrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->LanguageCode), 'ReverseOrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->LanguageCode, false)));
$this->colCountryCode = new QDataGridColumn(t('Country Code'), '<?= $_CONTROL->ParentControl->dtgLanguage_CountryCodeColumn_Render($_ITEM) ?>', array('OrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->CountryCode), 'ReverseOrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->CountryCode, false)));
$this->colEncoding = new QDataGridColumn(t('Encoding'), '<?= $_CONTROL->ParentControl->dtgLanguage_EncodingColumn_Render($_ITEM) ?>', array('OrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->Encoding), 'ReverseOrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->Encoding, false)));
$this->colTextDirection = new QDataGridColumn(t('Text Direction'), '<?= $_CONTROL->ParentControl->dtgLanguage_TextDirectionColumn_Render($_ITEM) ?>', array('OrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->TextDirection), 'ReverseOrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->TextDirection, false)));
$this->colSpecialCharacters = new QDataGridColumn(t('Special Characters'), '<?= $_CONTROL->ParentControl->dtgLanguage_SpecialCharactersColumn_Render($_ITEM) ?>', array('OrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->SpecialCharacters), 'ReverseOrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->SpecialCharacters, false)));
$this->colPluralForm = new QDataGridColumn(t('Plural Forms'), '<?= $_CONTROL->ParentControl->dtgLanguage_PluralFormColumn_Render($_ITEM) ?>', array('OrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->SpecialCharacters), 'ReverseOrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->SpecialCharacters, false)));
$this->colActive = new QDataGridColumn(t('Active'), '<?= $_CONTROL->ParentControl->dtgLanguage_ActiveColumn_Render($_ITEM) ?>', array('OrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->Active), 'ReverseOrderByClause' => QQ::OrderBy(QQN::NarroLanguage()->Active, false)));
$this->colActive->HtmlEntities = false;
$this->colActions = new QDataGridColumn(t('Actions'), '<?= $_CONTROL->ParentControl->dtgLanguage_Actions_Render($_ITEM) ?>');
$this->colActions->HtmlEntities = false;
// Setup DataGrid
$this->dtgLanguage = new NarroLanguageDataGrid($this);
$this->dtgLanguage->ShowHeader = true;
$this->dtgLanguage->Title = t('Languages');
// Datagrid Paginator
$this->dtgLanguage->Paginator = new QPaginator($this->dtgLanguage);
$this->dtgLanguage->ItemsPerPage = QApplication::$User->GetPreferenceValueByName('Items per page');
// Specify Whether or Not to Refresh using Ajax
$this->dtgLanguage->UseAjax = false;
// Specify the local databind method this datagrid will use
$this->dtgLanguage->SetDataBinder('dtgLanguage_Bind', $this);
$colTranslationCount = new QDataGridColumn(t('Translations'));
$colTranslationCount->Html = '<?=$_CONTROL->ParentControl->colTranslationCount_Render($_ITEM)?>';
$colTranslationCount->HtmlEntities = false;
$colTranslationCount->OrderByClause = QQ::OrderBy(QQ::Virtual('__translations_count', QQ::SubSql('SELECT COUNT(suggestion_id)')), 1);
$colTranslationCount->ReverseOrderByClause = QQ::OrderBy(QQ::Virtual('__translations_count', QQ::SubSql('SELECT COUNT(suggestion_id)')), 0);
$colTranslationCount->HorizontalAlign = QHorizontalAlign::Right;
$colLastTranslation = new QDataGridColumn(t('Last translation'));
$colLastTranslation->Html = '<?=$_CONTROL->ParentControl->colLastTranslation_Render($_ITEM)?>';
$colLastTranslation->HtmlEntities = false;
$colLastTranslation->OrderByClause = QQ::OrderBy(QQ::Virtual('last_translation'), 1);
$colLastTranslation->ReverseOrderByClause = QQ::OrderBy(QQ::Virtual('last_translation'), 0);
$colLastTranslation->HorizontalAlign = QHorizontalAlign::Right;
$this->dtgLanguage->AddColumn($this->colLanguageName);
$this->dtgLanguage->AddColumn($this->colLanguageCode);
$this->dtgLanguage->AddColumn($this->colCountryCode);
$this->dtgLanguage->AddColumn($colTranslationCount);
$this->dtgLanguage->AddColumn($colLastTranslation);
$this->dtgLanguage->AddColumn($this->colEncoding);
$this->dtgLanguage->AddColumn($this->colTextDirection);
$this->dtgLanguage->AddColumn($this->colSpecialCharacters);
$this->dtgLanguage->AddColumn($this->colPluralForm);
if (QApplication::HasPermission('Can edit language', null)) {
$this->dtgLanguage->AddColumn($this->colActions);
$this->dtgLanguage->AddColumn($this->colActive);
}
$this->dtgLanguage->SortColumnIndex = 0;
$this->lstFilter = new QListBox($this);
$this->lstFilter->AddItem(t('all languages'), 0);
$this->lstFilter->AddItem(t('active languages'), 1, true);
if (QApplication::$UseAjax) {
$this->lstFilter->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lstFilter_Change'));
} else {
$this->lstFilter->AddAction(new QChangeEvent(), new QServerControlAction($this, 'lstFilter_Change'));
}
$this->txtSearch = new QTextBox($this);
$this->btnSearch = new QButton($this);
$this->btnSearch->Text = t('Search');
$this->btnSearch->PrimaryButton = true;
if (QApplication::$UseAjax) {
$this->btnSearch->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSearch_Click'));
} else {
$this->btnSearch->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnSearch_Click'));
}
}