protected function Form_Create()
 {
     parent::Form_Create();
     // Use the CreateFromPathInfo shortcut (this can also be done manually using the NarroContextCommentMetaControl constructor)
     // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
     $this->mctNarroContextComment = NarroContextCommentMetaControl::CreateFromPathInfo($this);
     // Call MetaControl's methods to create qcontrols based on NarroContextComment's data fields
     $this->lblCommentId = $this->mctNarroContextComment->lblCommentId_Create();
     $this->lstContext = $this->mctNarroContextComment->lstContext_Create();
     $this->calCreated = $this->mctNarroContextComment->calCreated_Create();
     $this->calModified = $this->mctNarroContextComment->calModified_Create();
     $this->txtCommentText = $this->mctNarroContextComment->txtCommentText_Create();
     $this->txtCommentTextMd5 = $this->mctNarroContextComment->txtCommentTextMd5_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 QAjaxAction('btnSave_Click'));
     $this->btnSave->CausesValidation = true;
     $this->btnCancel = new QButton($this);
     $this->btnCancel->Text = QApplication::Translate('Cancel');
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
     $this->btnDelete = new QButton($this);
     $this->btnDelete->Text = QApplication::Translate('Delete');
     $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(sprintf(QApplication::Translate('Are you SURE you want to DELETE this %s?'), QApplication::Translate('NarroContextComment'))));
     $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click'));
     $this->btnDelete->Visible = $this->mctNarroContextComment->EditMode;
 }
Ejemplo n.º 2
0
 protected function Form_Create()
 {
     if (!QApplication::$Login) {
         QApplication::Redirect('/');
     }
     $this->objQcodoClass = QcodoClass::Load(QApplication::PathInfo(0));
     if (!$this->objQcodoClass) {
         throw new Exception('Invalid QcodoClass Id: ' . QApplication::PathInfo(0));
     }
     $this->lblName = new QLabel($this);
     $this->lblName->Text = $this->objQcodoClass->Name;
     $this->lstClassGroup = new QListBox($this);
     $this->lstClassGroup->Name = 'Class Group/Classification';
     foreach (ClassGroup::LoadAll(QQ::Clause(QQ::OrderBy(QQN::ClassGroup()->OrderNumber))) as $objClassGroup) {
         $this->lstClassGroup->AddItem($objClassGroup->Name, $objClassGroup->Id, $objClassGroup->Id == $this->objQcodoClass->ClassGroupId);
     }
     $this->chkEnumerationFlag = new QCheckBox($this);
     $this->chkEnumerationFlag->Checked = $this->objQcodoClass->EnumerationFlag;
     $this->chkEnumerationFlag->Name = 'Enumeration Class Flag';
     $this->txtShortDescription = new QTextBox($this);
     $this->txtShortDescription->Name = QApplication::Translate('Short Description');
     $this->txtShortDescription->Text = $this->objQcodoClass->ShortDescription;
     $this->txtShortDescription->TextMode = QTextMode::MultiLine;
     $this->txtExtendedDescription = new QWriteBox($this);
     $this->txtExtendedDescription->Name = QApplication::Translate('Extended Description');
     $this->txtExtendedDescription->Text = $this->objQcodoClass->ExtendedDescription;
     $this->btnSave = new QButton($this);
     $this->btnSave->Text = 'Save';
     $this->btnSave->AddAction(new QClickEvent(), new QServerAction('btnSave_Click'));
     $this->btnSave->CausesValidation = true;
     $this->btnCancel = new QButton($this);
     $this->btnCancel->Text = 'Cancel';
     $this->btnCancel->AddAction(new QClickEvent(), new QServerAction('btnCancel_Click'));
     $this->btnCancel->CausesValidation = false;
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 /**
  * 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;
 }
 /**
  * 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.');
 }
Ejemplo n.º 6
0
 protected function Form_Create()
 {
     if (!QApplication::$User) {
         $this->RedirectToListPage();
     }
     // Use the CreateFromPathInfo shortcut (this can also be done manually using the WordMetaControl constructor)
     // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
     $this->mctWord = WordMetaControl::CreateFromPathInfo($this);
     // Call MetaControl's methods to create qcontrols based on Word's data fields
     $this->lblWordId = $this->mctWord->lblWordId_Create();
     $this->lblWordId->Name = 'Id';
     $this->txtWord = $this->mctWord->txtWord_Create();
     $this->txtWord->Name = 'Cuvânt';
     $this->lstStatusType = $this->mctWord->lstStatusType_Create();
     $this->lstStatusType->Name = 'Stare';
     $this->txtProposalCount = $this->mctWord->txtProposalCount_Create();
     $this->txtProposalCount->Enabled = false;
     $this->txtProposalCount->Name = 'Propuneri';
     $this->calLastSent = $this->mctWord->calLastSent_Create();
     $this->calLastSent->Name = 'Ultima propunere';
     $this->calLastSent->Enabled = false;
     // Create Buttons and Actions on this Form
     $this->btnSave = new QButton($this);
     $this->btnSave->Text = QApplication::Translate('Save');
     $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click'));
     $this->btnSave->CausesValidation = true;
     $this->btnCancel = new QButton($this);
     $this->btnCancel->Text = QApplication::Translate('Cancel');
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('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('Word') . '?'));
     $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click'));
     $this->btnDelete->Visible = $this->mctWord->EditMode;
 }
 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;
 }
 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);
 }
Ejemplo n.º 9
0
 protected function Form_Create()
 {
     // Setup DataGrid Columns
     // Note that although we are using "Beta 2" style of SortBy and LimitInfo, QDataGrid does have support to "convert" QQ::OrderBy to SortBy strings.
     $this->colId = new QDataGridColumn(QApplication::Translate('Id'), '<?= $_ITEM->Id; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Id), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Id, false)));
     /*			$this->colId = new QDataGridColumn(QApplication::Translate('Id'), '<?= $_ITEM->Id; ?>', 'SortByCommand="id ASC"', 'ReverseSortByCommand="id DESC"');*/
     $this->colFirstName = new QDataGridColumn(QApplication::Translate('First Name'), '<?= $_ITEM->FirstName; ?>', 'SortByCommand="first_name ASC"', 'ReverseSortByCommand="first_name DESC"');
     $this->colLastName = new QDataGridColumn(QApplication::Translate('Last Name'), '<?= $_ITEM->LastName; ?>', 'SortByCommand="last_name ASC"', 'ReverseSortByCommand="last_name DESC"');
     // Setup DataGrid
     $this->dtgPerson = new QDataGrid($this);
     $this->dtgPerson->CellSpacing = 0;
     $this->dtgPerson->CellPadding = 4;
     $this->dtgPerson->BorderStyle = QBorderStyle::Solid;
     $this->dtgPerson->BorderWidth = 1;
     $this->dtgPerson->GridLines = QGridLines::Both;
     $this->dtgPerson->SortColumnIndex = 0;
     // Datagrid Paginator
     $this->dtgPerson->Paginator = new QPaginator($this->dtgPerson);
     $this->dtgPerson->ItemsPerPage = 5;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgPerson->UseAjax = true;
     // Add the Columns to the DataGrid
     $this->dtgPerson->AddColumn($this->colId);
     $this->dtgPerson->AddColumn($this->colFirstName);
     $this->dtgPerson->AddColumn($this->colLastName);
 }
 /**
  * This function tests whether everything was as needed or not
  * (uploaded image was within the range specified)
  * @return bool
  */
 public function Validate()
 {
     $blnToReturn = parent::Validate();
     if ($blnToReturn) {
         if ($this->blnRequired) {
             list($width, $height) = getimagesize($this->File);
             if (isset($this->intMinWidth) and $this->intMinWidth > $width) {
                 $blnToReturn = false;
                 $this->ValidationError = $this->strName . QApplication::Translate(' is too short the min width is ') . $this->intMinWidth;
             }
             if (isset($this->intMaxWidth) and $this->intMaxWidth < $width) {
                 $blnToReturn = false;
                 $this->ValidationError = $this->strName . QApplication::Translate(' is too big the max width is ') . $this->intMaxWidth;
             }
             if (isset($this->intMinHeight) and $this->intMinHeight > $height) {
                 $blnToReturn = false;
                 $this->ValidationError = $this->strName . QApplication::Translate(' is too short the min height is ') . $this->intMinHeight;
             }
             if (isset($this->intMaxHeight) and $this->intMaxHeight < $height) {
                 $blnToReturn = false;
                 $this->ValidationError = $this->strName . QApplication::Translate(' is too big the max height is ') . $this->intMaxHeight;
             }
         }
     }
     return $blnToReturn;
 }
Ejemplo n.º 11
0
Archivo: region.php Proyecto: alcf/chms
 protected function Form_Create()
 {
     // Use the CreateFromPathInfo shortcut (this can also be done manually using the GrowthGroupLocationMetaControl constructor)
     // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
     $this->mctGrowthGroupLocation = GrowthGroupLocationMetaControl::CreateFromPathInfo($this);
     $this->strPageTitle = 'Growth Groups - Edit Region';
     // Call MetaControl's methods to create qcontrols based on GrowthGroupLocation's data fields
     $this->lblId = $this->mctGrowthGroupLocation->lblId_Create();
     $this->txtLocation = $this->mctGrowthGroupLocation->txtLocation_Create();
     $this->txtLongitude = $this->mctGrowthGroupLocation->txtLongitude_Create();
     $this->txtLatitude = $this->mctGrowthGroupLocation->txtLatitude_Create();
     $this->txtZoom = $this->mctGrowthGroupLocation->txtZoom_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 QAjaxAction('btnSave_Click'));
     $this->btnSave->CausesValidation = true;
     $this->btnCancel = new QButton($this);
     $this->btnCancel->Text = QApplication::Translate('Cancel');
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('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('GrowthGroupLocation') . '?'));
     $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click'));
     $this->btnDelete->Visible = false;
 }
 /**
  * Validate the control.
  * @return bool
  */
 public function Validate()
 {
     if (!parent::Validate()) {
         return false;
     }
     if ($this->strText != '') {
         $dttDateTime = new QDateTime($this->strText, null, QDateTime::DateOnlyType);
         if ($dttDateTime->IsDateNull()) {
             $this->ValidationError = QApplication::Translate("Invalid date");
             return false;
         }
         if (!is_null($this->Minimum)) {
             if ($dttDateTime->IsEarlierThan($this->Minimum)) {
                 if ($this->strMinDateErrorMsg) {
                     $this->ValidationError = $this->strMinDateErrorMsg;
                 } else {
                     $this->ValidationError = QApplication::Translate("Date is earlier than minimum allowed");
                 }
                 return false;
             }
         }
         if (!is_null($this->Maximum)) {
             if ($dttDateTime->IsLaterThan($this->Maximum)) {
                 if ($this->strMaxDateErrorMsg) {
                     $this->ValidationError = $this->strMaxDateErrorMsg;
                 } else {
                     $this->ValidationError = QApplication::Translate("Date is later than maximum allowed");
                 }
                 return false;
             }
         }
     }
     return true;
 }
Ejemplo n.º 13
0
 /**
  * Override QLabel lblPriorLastNames
  * @param string $strControlId optional ControlId to use
  * @return QLabel
  */
 public function lblPriorLastNames_Create($strControlId = null)
 {
     $this->lblPriorLastNames = new QLabel($this->objParentObject, $strControlId);
     $this->lblPriorLastNames->Name = QApplication::Translate('Alternative Last Names');
     $this->lblPriorLastNames->Text = $this->objPerson->PriorLastNames;
     return $this->lblPriorLastNames;
 }
Ejemplo n.º 14
0
 /**
  * Create and setup QListBox lstParentGroup
  * Overrides code-generated version by providing full hierarchy and NOT allowing for "looped families"
  * @param string $strControlId optional ControlId to use
  * @param QQCondition $objConditions not used
  * @param QQClause[] $objOptionalClauses not used
  * @return QListBox
  */
 public function lstParentGroup_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     $this->lstParentGroup = new QListBox($this->objParentObject, $strControlId);
     $this->lstParentGroup->Name = QApplication::Translate('Parent Group');
     $this->lstParentGroup->AddItem(QApplication::Translate('- None -'), null);
     $this->lstParentGroup->HtmlEntities = false;
     // Setup and perform the Query
     if (is_null($objCondition)) {
         $objCondition = QQ::All();
     }
     $objParentGroupCursor = Group::QueryCursor($objCondition, $objOptionalClauses);
     $intLevelToSkipUntil = null;
     foreach (Group::LoadOrderedArrayByMinistryIdAndConfidentiality($this->objGroup->MinistryId, false) as $objGroup) {
         if ($objGroup->Id == $this->objGroup->Id) {
             $intLevelToSkipUntil = $objGroup->HierarchyLevel;
         } else {
             if (!is_null($intLevelToSkipUntil) && $objGroup->HierarchyLevel <= $intLevelToSkipUntil) {
                 $intLevelToSkipUntil = null;
             }
         }
         if (is_null($intLevelToSkipUntil) && $objGroup->GroupTypeId == GroupType::GroupCategory) {
             $strName = $objGroup->Name;
             if ($objGroup->HierarchyLevel) {
                 $strName = str_repeat('&nbsp;', $objGroup->HierarchyLevel * 3) . '&gt; ' . QApplication::HtmlEntities($strName);
             }
             $objListItem = new QListItem($strName, $objGroup->Id);
             if ($this->objGroup->ParentGroup && $this->objGroup->ParentGroup->Id == $objGroup->Id) {
                 $objListItem->Selected = true;
             }
             $this->lstParentGroup->AddItem($objListItem);
         }
     }
     // Return the QListBox
     return $this->lstParentGroup;
 }
Ejemplo n.º 15
0
 protected function Form_Create()
 {
     $this->pnlTitle = new QPanel($this);
     $this->pnlTitle->Text = QApplication::Translate('AJAX Dashboard');
     $this->pnlList = new QPanel($this, 'pnlList');
     $this->pnlList->AutoRenderChildren = true;
     $this->pnlEdit = new QPanel($this, 'pnlEdit');
     $this->pnlEdit->AutoRenderChildren = true;
     $this->pnlEdit->Visible = false;
     $this->lstClassNames = new QListBox($this);
     $this->lstClassNames->AddItem(QApplication::Translate('- Select One -'), null);
     // Use the strClassNameArray as magically determined above to aggregate the listbox of classes
     // Obviously, this should be modified if you want to make a custom dashboard
     global $strClassNameArray;
     foreach ($strClassNameArray as $strKey => $strValue) {
         $this->lstClassNames->AddItem($strKey, $strValue);
     }
     $this->lstClassNames->AddAction(new QChangeEvent(), new QAjaxAction('lstClassNames_Change'));
     // Create spinner which will be displayed during the every call unless specified otherwise
     $this->objDefaultWaitIcon = new QWaitIcon($this);
     $this->objDefaultWaitIcon->Text = sprintf('<img src="%s/spinner_20.gif" width="20" height="20" alt="Please Wait..."/>', __VIRTUAL_DIRECTORY__ . __IMAGE_ASSETS__);
     $this->objDefaultWaitIcon->Position = QPosition::Absolute;
     $this->objDefaultWaitIcon->Top = 230;
     $this->objDefaultWaitIcon->Left = 140;
 }
Ejemplo n.º 16
0
 protected function Form_Create()
 {
     // Use the CreateFromPathInfo shortcut (this can also be done manually using the SharedetailsMetaControl constructor)
     // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
     $this->mctSharedetails = SharedetailsMetaControl::CreateFromPathInfo($this);
     // Call MetaControl's methods to create qcontrols based on Sharedetails's data fields
     $this->lblId = $this->mctSharedetails->lblId_Create();
     $this->txtAsin = $this->mctSharedetails->txtAsin_Create();
     $this->txtEmail = $this->mctSharedetails->txtEmail_Create();
     $this->calTakenDate = $this->mctSharedetails->calTakenDate_Create();
     $this->calReturnDate = $this->mctSharedetails->calReturnDate_Create();
     $this->txtTitle = $this->mctSharedetails->txtTitle_Create();
     $this->txtFullName = $this->mctSharedetails->txtFullName_Create();
     $this->calActualReturnDate = new QDateTimePicker($this);
     $this->calActualReturnDate->Name = QApplication::Translate('Actual Return Date');
     /*			$this->calActualReturnDate->DateTime = $this->objSharedetails->TakenDate;*/
     $this->calActualReturnDate->DateTimePickerType = QDateTimePickerType::Date;
     // Create Buttons and Actions on this Form
     $this->btnSave = new QButton($this);
     $this->btnSave->Text = QApplication::Translate('Save');
     $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click'));
     $this->btnSave->CausesValidation = true;
     $this->btnCancel = new QButton($this);
     $this->btnCancel->Text = QApplication::Translate('Cancel');
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
     $this->btnDelete = new QButton($this);
     $this->btnDelete->Text = QApplication::Translate('Return');
     $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click'));
     $this->btnDelete->Visible = $this->mctSharedetails->EditMode;
 }
Ejemplo n.º 17
0
 /**
  * @return string The task progress, like "37/102, 02:37 elapsed"
  */
 public function get_progress()
 {
     $intUsersCount = $this->get_process_objects_count();
     $intProcessedUsersCount = $this->intOffset;
     $strTimeElapsed = QApplication::Translate("N/A");
     if ($this->intTimeElapsed) {
         $spanTime = new QDateTimeSpan($this->intTimeElapsed);
         $strHours = "";
         $intHours = $spanTime->Hours;
         if ($intHours > 0) {
             $strHours = $intHours . ":";
             if ($intHours < 10) {
                 $strHours = "0" . $strHours;
             }
         }
         $strMinutes = "";
         $intMinutes = $spanTime->Minutes;
         $strMinutes = $intMinutes . ":";
         if ($intMinutes < 10) {
             $strMinutes = "0" . $strMinutes;
         }
         $strSeconds = "";
         $intSeconds = $spanTime->Seconds;
         $intSeconds = $intSeconds - 3600 * $intHours - 60 * $intMinutes;
         $strSeconds = $intSeconds . "";
         if ($intSeconds < 10) {
             $strSeconds = "0" . $strSeconds;
         }
         $strTimeElapsed = $strHours . $strMinutes . $strSeconds;
     }
     return sprintf("%s/%s, %s elapsed.", $intProcessedUsersCount, $intUsersCount, $strTimeElapsed);
 }
Ejemplo n.º 18
0
 public function __construct($objParentObject, $strControlId = null)
 {
     parent::__construct($objParentObject, $strControlId);
     $this->strLabelForRequired = QApplication::Translate('%s is required');
     $this->strLabelForRequiredUnnamed = QApplication::Translate('Required');
     $this->objItemStyle = new QListItemStyle();
 }
Ejemplo n.º 19
0
 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');
 }
Ejemplo n.º 20
0
 public function __construct($objParentObject, $strControlId = null, $intEntityQtypeId = null, $intEntityId = null)
 {
     parent::__construct($objParentObject, $strControlId);
     // Setup Default Properties
     $this->TemporaryUploadPath = __DOCROOT__ . __SUBDIRECTORY__ . '/uploads/attachments';
     $this->strTemplate = __DOCROOT__ . __SUBDIRECTORY__ . '/common/QAttach.tpl.php';
     $this->UploadText = QApplication::Translate('Upload');
     $this->CancelText = QApplication::Translate('Cancel');
     $this->btnUpload->Text = '<input type="button" class="button" value="Attach">';
     $this->DialogBoxHtml = '<h1>Upload a File</h1><p>Please select a file to upload.</p>';
     $this->DisplayStyle = QDisplayStyle::Inline;
     $this->EntityId = $intEntityId;
     $this->EntityQtypeId = $intEntityQtypeId;
     $this->dlgFileAsset->lblError->ForeColor = 'red';
     $this->dlgFileAsset->flcFileAsset = new QFileControlExt($this->dlgFileAsset);
     // This is appalling, but the best I could come up with
     // So I remove all of the actions that are created on btnUpload in QFileAssetBase
     // Then I add them back, but only after changing the src URI for the spinner gif. Gross.
     $this->dlgFileAsset->btnUpload->RemoveAllActions('onclick');
     $this->dlgFileAsset->btnUpload->AddAction(new QClickEvent(), new QToggleEnableAction($this->dlgFileAsset->btnUpload));
     $this->dlgFileAsset->btnUpload->AddAction(new QClickEvent(), new QToggleEnableAction($this->dlgFileAsset->btnCancel));
     $this->dlgFileAsset->objSpinner->Text = sprintf('<img src="%s/spinner_white.gif" width="14" height="14" alt="Please Wait..."/>', __VIRTUAL_DIRECTORY__ . __IMAGE_ASSETS__);
     $this->dlgFileAsset->btnUpload->AddAction(new QClickEvent(), new QToggleDisplayAction($this->dlgFileAsset->objSpinner));
     $this->dlgFileAsset->btnUpload->AddAction(new QClickEvent(), new QServerControlAction($this->dlgFileAsset, 'btnUpload_Click'));
 }
Ejemplo n.º 21
0
 protected function GetItemHtml($objItem)
 {
     $strItemId = $this->strControlId . '_' . $objItem->ItemId;
     $objChildren = $objItem->ChildItemArray;
     $intChildCount = count($objChildren);
     $strSubNodeHtml = '';
     $strImageHtml = '';
     $strLabelHtml = '';
     if ($intChildCount) {
         // This Item has Children -- Must show either Collapsed or Expanded icon
         if ($objItem->Expanded) {
             $strImageHtml = sprintf('<span style="margin-right: 2px;"><img id="%s_image" src="%s/treenav_expanded.png" width="11" height="11" alt="" style="position: relative; top: 2px; cursor: pointer;" onclick="treenavToggleImage(\'%s\')"/></span>', $strItemId, __VIRTUAL_DIRECTORY__ . __IMAGE_ASSETS__, $strItemId);
             for ($intIndex = 0; $intIndex < $intChildCount; $intIndex++) {
                 $objChildItem = $objChildren[$intIndex];
                 $strChildItemId = $this->strControlId . '_' . $objChildItem->ItemId;
                 $strSubNodeHtml .= sprintf('<div id="%s">%s</div>', $strChildItemId, $this->GetItemHtml($objChildItem, $strChildItemId));
             }
             $strSubNodeHtml = sprintf('<div id="%s_sub" style="margin-left: %spx;">%s</div>', $strItemId, $this->intIndentWidth, $strSubNodeHtml);
         } else {
             $strSubNodeHtml = sprintf('<div id="%s_sub" style="margin-left: %spx; display: none;"><span class="%s" style="cursor: auto;">%s</span></div>', $strItemId, $this->intIndentWidth, $this->strItemCssStyle, QApplication::Translate('Loading...'));
             $strCommand = sprintf('onclick="treenavToggleImage(\'%s\'); qc.pA(\'%s\', \'%s\', \'QTreeNav_Expand\', \'%s\')"', $strItemId, $this->objForm->FormId, $this->strControlId, $strItemId);
             $strImageHtml = sprintf('<span style="margin-right: 2px;"><img id="%s_image" src="%s/treenav_not_expanded.png" width="11" height="11" alt="" style="position: relative; top: 2px; cursor: pointer;" %s/></span>', $strItemId, __VIRTUAL_DIRECTORY__ . __IMAGE_ASSETS__, $strCommand);
         }
     } else {
         // No Children -- we are displaying an End Node
         $strImageHtml = '<span style="margin-right: 2px;"><img src="' . __VIRTUAL_DIRECTORY__ . __IMAGE_ASSETS__ . '/treenav_child.png" width="11" height="11" alt="" style="position: relative; top: 2px;"/></span>';
     }
     $strCommand = sprintf('onclick="qc.pA(\'%s\', \'%s\', \'QChangeEvent\', \'%s\')"', $this->objForm->FormId, $this->strControlId, $strItemId);
     $strLabelHtml = sprintf('<span id="%s_label" class="%s" onmouseover="treenavItemSetStyle(\'%s_label\', \'%s\')" onmouseout="treenavItemSetStyle(\'%s_label\', \'%s\')" %s>%s</span>', $strItemId, $objItem->Selected ? $this->strItemSelectedCssStyle : $this->strItemCssStyle, $strItemId, $this->strItemHoverCssStyle, $strItemId, $objItem->Selected ? $this->strItemSelectedCssStyle : $this->strItemCssStyle, $strCommand, $objItem->Name);
     if ($this->intItemWidth > 0) {
         return sprintf('<div style="height: %spx; width: %spx;">%s%s</div>%s', $this->intItemHeight, $this->intItemWidth, $strImageHtml, $strLabelHtml, $strSubNodeHtml);
     } else {
         return sprintf('<div style="height: %spx;">%s%s</div>%s', $this->intItemHeight, $strImageHtml, $strLabelHtml, $strSubNodeHtml);
     }
 }
Ejemplo n.º 22
0
 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;
 }
Ejemplo n.º 23
0
 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 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;
 }
 protected function txtLongDescription_Create()
 {
     $this->txtLongDescription = new QTextBox($this);
     $this->txtLongDescription->TextMode = QTextMode::MultiLine;
     $this->txtLongDescription->Name = QApplication::Translate('Long Description');
     $this->txtLongDescription->strControlId = 'LongDescription';
 }
 protected function GetControlHtml()
 {
     if (!$this->strFontNames) {
         //				throw new QCallerException('Must specify a FontNames value before rendering this QImageLabel');
         return;
     }
     $strSerialized = $this->Serialize();
     if ($this->strCacheFolder) {
         $strHash = md5($strSerialized);
         $strFilePath = sprintf('%s%s/%s.%s', __DOCROOT__, str_replace(__VIRTUAL_DIRECTORY__, '', $this->strCacheFolder), $strHash, $this->strImageType);
         if (!file_exists($strFilePath)) {
             $this->RenderImage($strFilePath);
         }
         $strPath = sprintf('%s/%s.%s', $this->strCacheFolder, $strHash, $this->strImageType);
         $this->strCachedImageFilePath = $strPath;
     } else {
         if (strlen($strSerialized) > 255) {
             throw new QCallerException(sprintf(QApplication::Translate("The filename size exceeded for the serialized QImageLabel control." . " The size is %s. The maximum value is 255. Try to set the CacheFolder property to solve the problem."), strlen($strSerialized)));
         }
         $strPath = sprintf('%s/image_label.php/%s/q.%s', __VIRTUAL_DIRECTORY__ . __PHP_ASSETS__, $strSerialized, $this->strImageType);
     }
     $attrOverrides['src'] = $strPath;
     $attrOverrides['alt'] = QApplication::HtmlEntities($this->strText);
     return $this->RenderTag('img', $attrOverrides, null, null, true);
 }
Ejemplo n.º 27
0
 protected function Form_Create()
 {
     // Use the CreateFromPathInfo shortcut (this can also be done manually using the PeopledetailsMetaControl constructor)
     // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
     $this->mctPeopledetails = PeopledetailsMetaControl::CreateFromPathInfo($this);
     // 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 QServerAction('btnSave_Click'));
     $this->btnSave->CausesValidation = true;
     $this->btnCancel = new QButton($this);
     $this->btnCancel->Text = QApplication::Translate('Cancel');
     $this->btnCancel->AddAction(new QClickEvent(), new QServerAction('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('Contact') . '?'));
     $this->btnDelete->AddAction(new QClickEvent(), new QServerAction('btnDelete_Click'));
     $this->btnDelete->Visible = $this->mctPeopledetails->EditMode;
 }
Ejemplo n.º 28
0
 /**
  * Create and setup QTextBox txtAddress
  * @param string $strControlId optional ControlId to use
  * @return QTextBox
  */
 public function txtAddress_Create($strControlId = null)
 {
     $this->txtAddress = new QEmailTextBox($this->objParentObject, $strControlId);
     $this->txtAddress->Name = QApplication::Translate('Address');
     $this->txtAddress->Text = $this->objEmail->Address;
     $this->txtAddress->MaxLength = Email::AddressMaxLength;
     return $this->txtAddress;
 }
 /**
  * Create and setup QTextBox txtUrl
  * @param string $strControlId optional ControlId to use
  * @return QTextBox
  */
 public function txtUrl_Create($strControlId = null)
 {
     $this->txtUrl = new UrlTextBox($this->objParentObject, $strControlId);
     $this->txtUrl->Name = QApplication::Translate('Url');
     $this->txtUrl->Text = $this->objPerson->Url;
     $this->txtUrl->MaxLength = Person::UrlMaxLength;
     return $this->txtUrl;
 }
Ejemplo n.º 30
0
 public function testTranslationBasic()
 {
     $this->setCustomTranslatorClass();
     $this->verifyTranslation("Required", QApplication::Translate("Required"), "Requis");
     $this->verifyTranslation("Hello", QApplication::Translate("Hello"), "Bonjour");
     // Verify the case when there's no translation available
     $this->verifyTranslation("Can't translate me!", QApplication::Translate("Can't translate me!"), "Can't translate me!");
 }