本文整理汇总了PHP中QApplication类的典型用法代码示例。如果您正苦于以下问题:PHP QApplication类的具体用法?PHP QApplication怎么用?PHP QApplication使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testModelView
/**
* runs a simple model/view app for a moment
*/
function testModelView()
{
if (!QCoreApplication::instance()) {
$argv = array("");
$app = new QApplication(1, $argv);
}
$model_a = new MyItemModel();
$treeView = new QTableView();
$treeView->setModel($model_a);
$treeView->show();
QTimer::singleShot(100, QCoreApplication::instance(), SLOT("quit()"));
$app->exec();
}
示例2: __construct
public function __construct($objParentObject, $strControlId = null)
{
parent::__construct($objParentObject, $strControlId);
$this->strNoun = QApplication::Translate('item');
$this->strNounPlural = QApplication::Translate('items');
$this->prxDatagridSorting = new QControlProxy($this);
}
示例3: Form_Run
protected function Form_Run()
{
QApplication::$LoadedPage = 'Home';
if ($_SESSION['User'] == '') {
QApplication::Redirect('index.php');
}
}
示例4: Validate
public function Validate()
{
if (!parent::Validate()) {
return false;
}
if ($this->strText != '') {
$dttDateTime = new QDateTime($this->strText);
if ($dttDateTime->IsDateNull()) {
$this->strValidationError = QApplication::Translate("invalid date");
return false;
}
if (!is_null($this->Minimum)) {
if ($dttDateTime->IsEarlierThan($this->Minimum)) {
$this->strValidationError = QApplication::Translate("date is earlier than minimum allowed");
return false;
}
}
if (!is_null($this->Maximum)) {
if ($dttDateTime->IsLaterThan($this->Maximum)) {
$this->strValidationError = QApplication::Translate("date is later than maximum allowed");
return false;
}
}
}
$this->strValidationError = '';
return true;
}
示例5: GetEndScript
public function GetEndScript()
{
$strToReturn = parent::GetEndScript();
if (QDateTime::$Translate) {
$strShortNameArray = array();
$strLongNameArray = array();
$strDayArray = array();
$dttMonth = new QDateTime('2000-01-01');
for ($intMonth = 1; $intMonth <= 12; $intMonth++) {
$dttMonth->Month = $intMonth;
$strShortNameArray[] = '"' . $dttMonth->ToString('MMM') . '"';
$strLongNameArray[] = '"' . $dttMonth->ToString('MMMM') . '"';
}
$dttDay = new QDateTime('Sunday');
for ($intDay = 1; $intDay <= 7; $intDay++) {
$strDay = $dttDay->ToString('DDD');
$strDay = html_entity_decode($strDay, ENT_COMPAT, QApplication::$EncodingType);
if (function_exists('mb_substr')) {
$strDay = mb_substr($strDay, 0, 2);
} else {
// Attempt to account for multibyte day -- may not work if the third character is multibyte
$strDay = substr($strDay, 0, strlen($strDay) - 1);
}
$strDay = QApplication::HtmlEntities($strDay);
$strDayArray[] = '"' . $strDay . '"';
$dttDay->Day++;
}
$strArrays = sprintf('new Array(new Array(%s), new Array(%s), new Array(%s))', implode(', ', $strLongNameArray), implode(', ', $strShortNameArray), implode(', ', $strDayArray));
$strToReturn .= sprintf('qc.regCAL("%s", "%s", "%s", "%s", %s); ', $this->strControlId, $this->dtxLinkedControl->ControlId, QApplication::Translate('Today'), QApplication::Translate('Cancel'), $strArrays);
} else {
$strToReturn .= sprintf('qc.regCAL("%s", "%s", "%s", "%s", null); ', $this->strControlId, $this->dtxLinkedControl->ControlId, QApplication::Translate('Today'), QApplication::Translate('Cancel'));
}
return $strToReturn;
}
示例6: MakeDirectory
/**
* Same as mkdir but correctly implements directory recursion.
* At its core, it will use the php MKDIR function.
* This method does no special error handling. If you want to use special error handlers,
* be sure to set that up BEFORE calling MakeDirectory.
*
* @param string $strPath actual path of the directoy you want created
* @param integer $intMode optional mode
*
* @return boolean the return flag from mkdir
*/
public static function MakeDirectory($strPath, $intMode = null)
{
if (is_dir($strPath)) {
// Directory Already Exists
return true;
}
// Check to make sure the parent(s) exist, or create if not
if (!self::MakeDirectory(dirname($strPath), $intMode)) {
return false;
}
if (PHP_OS != "Linux") {
// Create the current node/directory, and return its result
$blnReturn = mkdir($strPath);
if ($blnReturn && !is_null($intMode)) {
// Manually CHMOD to $intMode (if applicable)
// mkdir doesn't do it for mac, and this will error on windows
// Therefore, ignore any errors that creep up
QApplication::SetErrorHandler(null);
chmod($strPath, $intMode);
QApplication::RestoreErrorHandler();
}
} else {
$blnReturn = mkdir($strPath, $intMode);
}
return $blnReturn;
}
示例7: btnLogin_Click
protected function btnLogin_Click($strFormId, $strControlId, $strParameter)
{
$objPerson = Person::LoadByUsername(trim(strtolower($this->txtUsername->Text)));
if (!$objPerson) {
$objPerson = Person::LoadByEmail(trim(strtolower($this->txtUsername->Text)));
}
if ($objPerson && $objPerson->IsPasswordValid($this->txtPassword->Text)) {
QApplication::LoginPerson($objPerson);
if ($this->chkRemember->Checked) {
QApplication::SetLoginTicketToCookie($objPerson);
}
// Redirect to the correct location
if ($objPerson->PasswordResetFlag) {
if (array_key_exists('strReferer', $_GET)) {
QApplication::Redirect('/profile/password.php?strReferer=' . urlencode($_GET['strReferer']));
} else {
QApplication::Redirect('/profile/password.php?strReferer=' . urlencode('/'));
}
} else {
if (array_key_exists('strReferer', $_GET)) {
QApplication::Redirect($_GET['strReferer']);
} else {
QApplication::Redirect('/');
}
}
}
// If we're here, either the username and/or password is not valid
$this->txtUsername->Warning = 'Invalid username or password';
$this->txtPassword->Text = null;
// Call Form_Validate() to do that blinking thing
$this->Form_Validate();
}
示例8: Form_Create
protected function Form_Create()
{
// Define our Label
$this->txtBasic = new QTextBox($this);
$this->txtBasic->Name = QApplication::Translate("Basic");
$this->txtBasic = new QTextBox($this);
$this->txtBasic->MaxLength = 5;
$this->txtInt = new QIntegerTextBox($this);
$this->txtInt->Maximum = 10;
$this->txtFlt = new QFloatTextBox($this);
$this->txtList = new QCsvTextBox($this);
$this->txtList->MinItemCount = 2;
$this->txtList->MaxItemCount = 5;
$this->txtEmail = new QEmailTextBox($this);
$this->txtUrl = new QUrlTextBox($this);
$this->txtCustom = new QTextBox($this);
// These parameters are fed into filter_var. See PHP doc on filter_var() for more info.
$this->txtCustom->ValidateFilter = FILTER_VALIDATE_REGEXP;
$this->txtCustom->ValidateFilterOptions = array('options' => array('regexp' => '/^(0x)?[0-9A-F]*$/i'));
// must be a hex decimal, optional leading 0x
$this->txtCustom->LabelForInvalid = 'Hex value required.';
$this->btnValidate = new QButton($this);
$this->btnValidate->Text = "Filter and Validate";
$this->btnValidate->AddAction(new QClickEvent(), new QServerAction());
// just validates
$this->btnValidate->CausesValidation = true;
}
示例9: ParsePostData
public function ParsePostData()
{
// Check to see if this Control's Value was passed in via the POST data
if (array_key_exists($this->strControlId, $_POST)) {
// It was -- update this Control's value with the new value passed in via the POST arguments
if ($this->strText != $_POST[$this->strControlId]) {
//$this->blnModified = true;
}
$this->strText = $_POST[$this->strControlId];
switch ($this->strCrossScripting) {
case QCrossScripting::Allow:
// Do Nothing, allow everything
break;
case QCrossScripting::HtmlEntities:
// Go ahead and perform HtmlEntities on the text
$this->strText = QApplication::HtmlEntities($this->strText);
break;
default:
// Deny the Use of CrossScripts
// Check for cross scripting patterns
// TODO: Change this to RegExp
$strText = strtolower($this->strText);
if (strpos($strText, '<script') !== false || strpos($strText, '<applet') !== false || strpos($strText, '<embed') !== false || strpos($strText, '<style') !== false || strpos($strText, '<link') !== false || strpos($strText, '<body') !== false || strpos($strText, '<iframe') !== false || strpos($strText, 'javascript:') !== false || strpos($strText, ' onfocus=') !== false || strpos($strText, ' onblur=') !== false || strpos($strText, ' onkeydown=') !== false || strpos($strText, ' onkeyup=') !== false || strpos($strText, ' onkeypress=') !== false || strpos($strText, ' onmousedown=') !== false || strpos($strText, ' onmouseup=') !== false || strpos($strText, ' onmouseover=') !== false || strpos($strText, ' onmouseout=') !== false || strpos($strText, ' onmousemove=') !== false || strpos($strText, ' onclick=') !== false || strpos($strText, '<object') !== false || strpos($strText, 'background:url') !== false) {
throw new QCrossScriptingException($this->strControlId);
}
}
}
}
示例10: SetupPanel
protected function SetupPanel()
{
if (!$this->objGroup->IsLoginCanView(QApplication::$Login)) {
$this->ReturnTo('/groups/');
}
$this->SetupViewControls(false, false);
$this->dtgMembers->SetDataBinder('dtgMembers_Bind', $this);
$this->txtFirstName = new QTextBox($this);
$this->txtFirstName->Name = 'First Name (Exact)';
$this->txtFirstName->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'dtgMembers_Refresh'));
$this->txtFirstName->AddAction(new QEnterKeyEvent(), new QAjaxControlAction($this, 'dtgMembers_Refresh'));
$this->txtFirstName->AddAction(new QEnterKeyEvent(), new QTerminateAction());
$this->txtLastName = new QTextBox($this);
$this->txtLastName->Name = 'Last Name (Exact)';
$this->txtLastName->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'dtgMembers_Refresh'));
$this->txtLastName->AddAction(new QEnterKeyEvent(), new QAjaxControlAction($this, 'dtgMembers_Refresh'));
$this->txtLastName->AddAction(new QEnterKeyEvent(), new QTerminateAction());
$this->lblQuery = new QLabel($this);
$this->lblQuery->Name = 'Search Parameters';
$this->lblQuery->Text = nl2br(QApplication::HtmlEntities($this->objGroup->SmartGroup->SearchQuery->Description));
$this->lblQuery->HtmlEntities = false;
if ($this->objGroup->CountEmailMessageRoutes()) {
$this->SetupEmailMessageControls();
}
$this->SetupSmsControls();
}
示例11: DisplayInProjectListInProgressColumn
public function DisplayInProjectListInProgressColumn(NarroProject $objProject, $strText = '')
{
$strExportText = '';
if ($objProject->ProjectType != NarroProjectType::Mozilla) {
return array($objProject, '');
}
$objCache = new NarroCache(__CLASS__, QApplication::GetLanguageId());
$objData = $objCache->GetData();
if (!$objData) {
$strJson = @file_get_contents($this->strUrl);
if ($strJson) {
$objData = json_decode($strJson);
if ($objData) {
$objCache->SaveData($objData);
}
}
}
if (is_array($objData->items)) {
foreach ($objData->items as $objItem) {
if ($objItem->id == sprintf('%s/%s', $objProject->GetPreferenceValueByName('Code name on mozilla l10n dashboard'), QApplication::$TargetLanguage->LanguageCode)) {
$strWarning = $objItem->warnings ? sprintf('%d warnings', $objItem->warnings) : '';
$strMissing = $objItem->missing ? sprintf('%d missing', $objItem->missing) : '';
$strExportText = sprintf('<a title="Visit the Mozilla l10n dashboard" target="_blank" href="https://l10n-stage-sj.mozilla.org/dashboard/compare?run=%d">%s</a>', $objItem->runid, join(', ', array($objItem->result, $strMissing, $strWarning)));
break;
}
}
}
return array($objProject, $strExportText);
}
示例12: SetupChildEditControls
protected function SetupChildEditControls()
{
$this->lstGrowthGroupLocation = $this->mctGrowthGroup->lstGrowthGroupLocation_Create();
$this->lstGrowthGroupStructure = $this->mctGrowthGroup->lstGrowthGroupStructures_Create();
$this->lstGrowthGroupStructure->Rows = 10;
$this->lstGrowthGroupStatus = new QListBox($this);
foreach (AvailabilityStatus::LoadAll() as $objStatus) {
$this->lstGrowthGroupStatus->AddItem($objStatus->Name, $objStatus->Id);
}
$this->lstGrowthGroupDayType = $this->mctGrowthGroup->lstGrowthGroupDayType_Create();
$this->txtStartTime = $this->mctGrowthGroup->txtStartTime_Create();
$this->txtEndTime = $this->mctGrowthGroup->txtEndTime_Create();
$this->txtAddress1 = $this->mctGrowthGroup->txtAddress1_Create();
$this->txtAddress2 = $this->mctGrowthGroup->txtAddress2_Create();
$this->txtCrossStreet1 = $this->mctGrowthGroup->txtCrossStreet1_Create();
$this->txtCrossStreet2 = $this->mctGrowthGroup->txtCrossStreet2_Create();
$this->txtZipCode = $this->mctGrowthGroup->txtZipCode_Create();
$this->txtLongitude = $this->mctGrowthGroup->txtLongitude_Create();
$this->txtLatitude = $this->mctGrowthGroup->txtLatitude_Create();
$this->txtAccuracy = $this->mctGrowthGroup->txtAccuracy_Create();
$this->txtAccuracy->Instructions = 'as reported by Google Maps -- this should ideally be 7';
$this->txtDescription = $this->mctGrowthGroup->txtDescription_Create();
$this->btnRefresh = new QButton($this);
$this->btnRefresh->Text = 'Lookup Using Google Maps';
$this->btnRefresh->AddAction(new QClickEvent(), new QToggleEnableAction($this->btnRefresh));
$this->btnRefresh->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnRefresh_Click'));
$this->cblMeetings = new QCheckBoxList($this, 'days');
$this->cblMeetings->Name = 'Meetings per Month';
foreach (array('1st', '2nd', '3rd', '4th', '5th', 'Every Other') as $intKey => $strName) {
$intValue = pow(2, $intKey);
$this->cblMeetings->AddItem($strName, $intValue, $this->mctGrowthGroup->GrowthGroup->MeetingBitmap & $intValue);
}
QApplication::ExecuteJavaScript('document.getElementById("days[5]").onclick = EveryOtherClicked;');
}
示例13: __construct
/**
* Constructor
*
* @param QControl|QForm $objParentObject Parent of this textbox
* @param null|string $strControlId Desired control ID for the textbox
*/
public function __construct($objParentObject, $strControlId = null)
{
parent::__construct($objParentObject, $strControlId);
// borrows too short and too long labels from super class
$this->strLabelForTooShort = QApplication::Translate('Enter at least %s items.');
$this->strLabelForTooLong = QApplication::Translate('Enter no more than %s items.');
}
示例14: 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;
}
示例15: 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;
}