Server IP : 103.118.17.23 / Your IP : 216.73.216.160 Web Server : Microsoft-IIS/10.0 System : Windows NT RESELLERPLESK22 10.0 build 20348 (Windows Server 2016) AMD64 User : IWAM_plesk(default) ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/vhosts/mesa.org.in/httpdocs/assets/_core/php/examples/other_controls/ |
Upload File : |
<?php require_once('../qcubed.inc.php'); class PersistentExampleForm extends QForm { // We will persist this control in the $_SESSION protected $ddnProjectPicker; // for the purpose of simplicity for this example, // we'll create a public QLabel to pass in the status // information between the Persistent Control $ddnProjectPicker // and this parent QForm. public $lblStatus; protected function Form_Create() { $this->lblStatus = new QLabel($this); // Initialize the text of the label; if the query // gets executed, this will be overwritten $this->lblStatus->Text = "The query to populate the dropdown was NOT executed"; $this->ddnProjectPicker = ProjectPickerListBox::CreatePersistent( 'ProjectPickerListBox', // name of the control class $this, // parent - the current QForm 'ddnProjects' // id on the form - just your usual ControlID ); } } /** * This class encapsulates the logic of populating a list box * with a set of projects. */ class ProjectPickerListBox extends QListBox { /** * This constructor will only be executed once - afterwards, * the state of the control will be stored into the $_SESSION * and, on future loads, populated from the session state. */ public function __construct($objParentObject, $strControlId) { parent::__construct($objParentObject, $strControlId); $projects = Project::QueryArray( QQ::All(), QQ::OrderBy(QQN::Project()->Name) ); foreach ($projects as $project) { $this->AddItem($project->Name, $project->Id); } // Reset the status of the parent form's label to indicate // that the query was actually run $objParentObject->lblStatus->Text = "The query was executed"; } } PersistentExampleForm::Run('PersistentExampleForm'); ?>