/** * 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(); }
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); }
protected function Form_Run() { QApplication::$LoadedPage = 'Home'; if ($_SESSION['User'] == '') { QApplication::Redirect('index.php'); } }
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; }
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; }
/** * 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; }
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(); }
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; }
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); } } } }
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(); }
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); }
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;'); }
/** * 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.'); }
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; }
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; }
/** * Creates the reset button html for use with multiple select boxes. * */ protected function GetResetButtonHtml() { $strJavaScriptOnClick = sprintf('$j("#%s").val(null);$j("#%s").trigger("change"); return false;', $this->strControlId, $this->strControlId); $strToReturn = sprintf(' <a id="reset_ctl_%s" href="#" class="listboxReset">%s</a>', $this->strControlId, QApplication::Translate('Reset')); QApplication::ExecuteJavaScript(sprintf('$j("#reset_ctl_%s").on("%s", function(){ %s });', $this->strControlId, "click", $strJavaScriptOnClick)); return $strToReturn; }
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; }
/** * Given a Temp File Path, this will save the database record AND copy the file at the temporary file path * to the file assets directory for headshots * @param string $strTempFilePath * @return void */ public function SaveHeadShot($strTempFilePath) { // Figure out the Image Type $mixImageInfo = getimagesize($strTempFilePath); switch ($mixImageInfo['mime']) { case 'image/gif': $this->intImageTypeId = ImageType::gif; break; case 'image/jpeg': $this->intImageTypeId = ImageType::jpg; break; case 'image/png': $this->intImageTypeId = ImageType::png; break; default: throw new QCallerException('Image Type Not Supported: ' . $mixImageInfo['mime']); } // Start the Transaction HeadShot::GetDatabase()->TransactionBegin(); // Save the DB Record, Make Folders (if appicable) and Save the File $this->Save(); QApplication::MakeDirectory($this->Folder, 0777); copy($strTempFilePath, $this->Path); chmod($this->Path, 0777); // Commit the Transaction HeadShot::GetDatabase()->TransactionCommit(); }
public function GetEndScript() { $strJS = parent::GetEndScript(); // Attach the qcubed tracking functions just after parent script attaches the widget to the html object QApplication::ExecuteJsFunction('qcubed.resizable', $this->GetJqControlId(), $this->ControlId, QJsPriority::High); return $strJS; }
public function __construct() { parent::__construct(); $quit = new QPushButton(tr("&Quit")); $quit->setFont(new QFont("Times", 18, QFont::Bold)); QObject::connect($quit, SIGNAL('clicked()'), QApplication::instance(), SLOT('quit()')); $angle = new LCDRange(); $angle->setRange(5, 70); $force = new LCDRange(); $force->setRange(10, 50); $cannonField = new CannonField(); QObject::connect($angle, SIGNAL('valueChanged(int)'), $cannonField, SLOT('setAngle(int)')); QObject::connect($cannonField, SIGNAL('angleChanged(int)'), $angle, SLOT('setValue(int)')); QObject::connect($force, SIGNAL('valueChanged(int)'), $cannonField, SLOT('setForce(int)')); QObject::connect($cannonField, SIGNAL('forceChanged(int)'), $force, SLOT('setValue(int)')); $shoot = new QPushButton(tr("&Shoot")); $shoot->setFont(new QFont("Times", 18, QFont::Bold)); QObject::connect($shoot, SIGNAL('clicked()'), $cannonField, SLOT('shoot()')); $topLayout = new QHBoxLayout(); $topLayout->addWidget($shoot); $topLayout->addStretch(1); $leftLayout = new QVBoxLayout(); $leftLayout->addWidget($angle); $leftLayout->addWidget($force); $gridLayout = new QGridLayout(); $gridLayout->addWidget($quit, 0, 0); $gridLayout->addLayout($topLayout, 0, 1); $gridLayout->addLayout($leftLayout, 1, 0); $gridLayout->addWidget($cannonField, 1, 1, 2, 1); $gridLayout->setColumnStretch(1, 10); $this->setLayout($gridLayout); $angle->setValue(60); $force->setValue(25); $angle->setFocus(); }
/** * Method will setup Internationalization. * NOTE: This method has been INTENTIONALLY left incomplete. * @return void */ public static function InitializeI18n() { if (isset($_SESSION)) { if (array_key_exists('country_code', $_SESSION)) { QApplication::$CountryCode = $_SESSION['country_code']; } if (array_key_exists('language_code', $_SESSION)) { QApplication::$LanguageCode = $_SESSION['language_code']; } } /* * NOTE: This is where you would implement code to do Language Setting discovery, as well, for example: * Checking against $_GET['language_code'] * checking against session (example provided below) * Checking the URL * etc. * Options to do this are left to the developer. */ // Initialize I18n if QApplication::$LanguageCode is set if (QApplication::$LanguageCode) { QI18n::Initialize(); } else { // QApplication::$CountryCode = 'us'; // QApplication::$LanguageCode = 'en'; // QI18n::Initialize(); } }
protected function Form_Create() { parent::Form_Create(); if (!QApplication::HasPermissionForThisLang('Can export project', $this->objProject->ProjectId)) { QApplication::Redirect(NarroLink::ProjectList()); } $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, '', 0, '', 0, 0, 10, 0, 0, t('Translate')); $pnlDummy = new QPanel($this->pnlMainTab); $arrHeaders[] = NarroLink::Review($this->objProject->ProjectId, '', NarroReviewPanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Review')); $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)) { $this->pnlSelectedTab = new NarroProjectExportPanel($this->objProject, $this->pnlMainTab); $arrHeaders[] = t('Export'); $this->pnlMainTab->Selected = count($arrHeaders) - 1; } $this->pnlMainTab->Headers = $arrHeaders; }
public function RenderValue(AttributeValue $objValue) { switch ($objValue->Attribute->AttributeDataTypeId) { case AttributeDataType::Text: return QApplication::HtmlEntities($objValue->TextValue); case AttributeDataType::Checkbox: return $objValue->BooleanValue ? 'Yes' : 'No'; case AttributeDataType::Date: return $objValue->DateValue->ToString('MMMM D, YYYY'); case AttributeDataType::DateTime: return $objValue->DatetimeValue->ToString('MMMM D, YYYY') . ' at ' . $objValue->DatetimeValue->ToString('h:mmz'); case AttributeDataType::ImmutableSingleDropdown: case AttributeDataType::MutableSingleDropdown: return $objValue->SingleAttributeOption != null ? QApplication::HtmlEntities($objValue->SingleAttributeOption->Name) : ' '; case AttributeDataType::ImmutableMultipleDropdown: case AttributeDataType::MutableMultipleDropdown: $strArray = array(); foreach ($objValue->GetAttributeOptionAsMultipleArray(QQ::OrderBy(QQN::AttributeOption()->Name)) as $objOption) { $strArray[] = '• ' . QApplication::HtmlEntities($objOption->Name); } return implode('<br/>', $strArray); default: throw new Exception('Unhandled Attribute Data Type'); } }
protected function GetRightHtml() { if ($this->strRightText) { return sprintf('<span class="input-group-addon">%s</span>', \QApplication::HtmlEntities($this->strRightText)); } return ''; }
public function __construct($objParentObject, $strFileUploadCallback, $strControlId = null) { // Call parent constructor and define FileUploadCallback parent::__construct($objParentObject, $strControlId); $this->strFileUploadCallback = $strFileUploadCallback; // Setup the Dialog Box, itself $this->strTemplate = __DOCROOT__ . __PHP_ASSETS__ . '/QFileAssetDialog.tpl.php'; $this->blnDisplay = false; $this->blnMatteClickable = false; $this->strTitle = QApplication::Translate("Upload a File"); // Controls for Upload FileAsset Dialog Box $this->lblMessage = new QLabel($this); $this->lblMessage->HtmlEntities = false; $this->lblError = new QLabel($this); $this->lblError->HtmlEntities = false; $this->flcFileAsset = new QFileControl($this); $this->btnUpload = new QButton($this); $this->btnCancel = new QButton($this); $this->objSpinner = new QWaitIcon($this); // Events on the Dialog Box Controls $this->flcFileAsset->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->btnUpload->AddAction(new QClickEvent(), new QToggleEnableAction($this->btnUpload)); $this->btnUpload->AddAction(new QClickEvent(), new QToggleEnableAction($this->btnCancel)); $this->btnUpload->AddAction(new QClickEvent(), new QToggleDisplayAction($this->objSpinner)); $this->btnUpload->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnUpload_Click')); $this->btnCancel->AddAction(new QClickEvent(), new QHideDialogBox($this)); }
public function __construct($objParentObject, $strControlId = null, $intEntityQtypeId = null, $intEntityId = null) { parent::__construct($objParentObject, $strControlId); $this->intAttachmentCount = Attachment::CountByEntityQtypeIdEntityId($intEntityQtypeId, $intEntityId); if ($this->intAttachmentCount > 0) { $this->strTemplate = __DOCROOT__ . __SUBDIRECTORY__ . '/common/QAttachments.tpl.php'; $this->lblAttachments_Create(); $this->pnlAttachments = new QPanel($this); $this->pnlAttachments->strTemplate = __DOCROOT__ . __SUBDIRECTORY__ . '/common/attachments.tpl.php'; $this->pnlAttachments->Display = false; $this->objAttachmentArray = Attachment::LoadArrayByEntityQtypeIdEntityId($intEntityQtypeId, $intEntityId); $this->arrAttachments = array(); foreach ($this->objAttachmentArray as $key => $objAttachment) { $strAttachment = sprintf('<strong><a href="' . __PHP_ASSETS__ . '/download.php?tmp_filename=%s&attachment_id=%s" target="_blank" style="color:blue;">%s</a></strong> (%s bytes) %s by %s ', $objAttachment->TmpFilename, $objAttachment->AttachmentId, $objAttachment->Filename, $objAttachment->Size, $objAttachment->CreationDate, $objAttachment->CreatedByObject->__toStringFullName()); $lblDelete = new QLabel($this->pnlAttachments); $lblDelete->Text = 'Delete<br/>'; $lblDelete->ForeColor = '#555555'; $lblDelete->FontUnderline = true; $lblDelete->SetCustomStyle('cursor', 'pointer'); $lblDelete->HtmlEntities = false; $lblDelete->ActionParameter = $objAttachment->AttachmentId; $lblDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you sure you want to delete this attachment?')); $lblDelete->AddAction(new QClickEvent(), new QServerControlAction($this, 'lblDelete_Click')); QApplication::AuthorizeControl($objAttachment, $lblDelete, 3); $this->arrAttachments[$key]['strAttachment'] = $strAttachment; $this->arrAttachments[$key]['lblDelete'] = $lblDelete; } } else { $this->Display = false; } }
/** * This will log a message to the Qcodo Log. Location of the log file is defined in __QCODO_LOG__ * * By default, this will log a "Normal" level log entry in the "default" Qcodo log file, which is * located at __QCODO_LOG__/default.log.txt * * Either parameter can be overridden. * * @param string $strMessage * @param integer $intLogLevel * @param string $strLogModule * @return void */ public static function Log($strMessage, $intLogLevel = QLogLevel::Normal, $strLogModule = 'default') { // Cancel out if log level is too low if ($intLogLevel > self::$MinimumLogLevel) { return; } // Setup Log Path if (!defined('__QCODO_LOG__')) { throw new QCallerException('__QCODO_LOG__ must be defined before running QLog::Log'); } // Cancel out if log path is null if (!__QCODO_LOG__) { return; } // Create the Log Directory if it does NOT yet exist if (!is_dir(__QCODO_LOG__)) { QApplication::MakeDirectory(__QCODO_LOG__, 0777); } // Setup the Line $strLine = sprintf("%5s | %s | %s | %s\r\n", getmypid(), QLogLevel::$NameArray[$intLogLevel], QDateTime::Now()->NowToString(QDateTime::FormatIso), self::FormatMessage($strMessage)); // Open the File for Writing $strLogFilePath = __QCODO_LOG__ . '/' . $strLogModule . self::$Extension; $objFile = fopen($strLogFilePath, 'a'); // Write the Line fwrite($objFile, $strLine); fclose($objFile); }
public function renderButton_Click($strFormId, $strControlId, $strParameter) { $intPersonId = intval($strParameter); QApplication::DisplayAlert("In a real application, you'd be redirected to the page that edits person #" . $intPersonId); // You'd do something like this in a real application: // QApplication::Redirect("person_edit.php?intPersonId=" . $intPersonId); }
public function __construct($objParentObject, $strControlId = null) { parent::__construct($objParentObject, $strControlId); $this->strLabelForInvalid = QApplication::Translate('Invalid Integer'); $this->strLabelForLess = QApplication::Translate('Value must be less than %s'); $this->strLabelForGreater = QApplication::Translate('Value must be greater than %s'); }
public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null) { // Call the Parent try { parent::__construct($objParentObject, $strControlId); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } // Setup Callback and Template $this->strTemplate = 'PeopledetailsEditPanel.tpl.php'; $this->strClosePanelMethod = $strClosePanelMethod; // Construct the PeopledetailsMetaControl // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent $this->mctPeopledetails = PeopledetailsMetaControl::Create($this, $intId); // Call MetaControl's methods to create qcontrols based on Peopledetails's data fields $this->lblId = $this->mctPeopledetails->lblId_Create(); $this->txtFullName = $this->mctPeopledetails->txtFullName_Create(); $this->txtAddress = $this->mctPeopledetails->txtAddress_Create(); $this->txtPhone = $this->mctPeopledetails->txtPhone_Create(); $this->txtEmail = $this->mctPeopledetails->txtEmail_Create(); // Create Buttons and Actions on this Form $this->btnSave = new QButton($this); $this->btnSave->Text = QApplication::Translate('Save'); $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click')); $this->btnSave->CausesValidation = $this; $this->btnCancel = new QButton($this); $this->btnCancel->Text = QApplication::Translate('Cancel'); $this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click')); $this->btnDelete = new QButton($this); $this->btnDelete->Text = QApplication::Translate('Delete'); $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('Peopledetails') . '?')); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click')); $this->btnDelete->Visible = $this->mctPeopledetails->EditMode; }