Labels are a little tricky with checkboxes. There are two built-in ways to make labels: 1) Assign a Name property, and render using something like RenderWithName 2) Assign a Text property, in which case the checkbox will be wrapped with a label and the text you assign.
Inheritance: extends QControl
Exemplo n.º 1
0
 protected function renderLabelAttributes()
 {
     if ($this->blnInline) {
         $this->getCheckLabelStyler()->AddCssClass(Bootstrap::CheckboxInline);
     }
     return parent::renderLabelAttributes();
 }
Exemplo n.º 2
0
 /**
  * @slot
  */
 public function updateCheckBox()
 {
     if ($this->delaySpinBox->value() == 0) {
         $this->hideThisWindowCheckBox->setDisabled(true);
     } else {
         $this->hideThisWindowCheckBox->setDisabled(false);
     }
 }
 public function dtgPermission_PermissionColumn_Render(NarroPermission $objPermission)
 {
     if (QApplication::HasPermission('Can manage roles')) {
         $strControlId = 'chkPermission' . $objPermission->PermissionId;
         $chkPermission = new QCheckBox($this->dtgPermission);
         $chkPermission->Text = t($objPermission->PermissionName);
         $chkPermission->ActionParameter = $objPermission->PermissionId;
         $chkPermission->Checked = NarroRolePermission::QueryCount(QQ::AndCondition(QQ::Equal(QQN::NarroRolePermission()->RoleId, $this->objRole->RoleId), QQ::Equal(QQN::NarroRolePermission()->PermissionId, $objPermission->PermissionId)));
         if (QApplication::$UseAjax) {
             $chkPermission->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'chkPermission_Click'));
         } else {
             $chkPermission->AddAction(new QClickEvent(), new QServerControlAction($this, 'chkPermission_Click'));
         }
         return $chkPermission->Render(false);
     } else {
         return t($objPermission->PermissionName);
     }
 }
Exemplo n.º 4
0
Arquivo: split.php Projeto: alcf/chms
 public function RenderRadio(HouseholdParticipation $objParticipation)
 {
     if ($objParticipation->Household->HeadPersonId == $objParticipation->PersonId) {
         // Do Nothing
         return ' ';
     } else {
         $chkSelect = new QCheckBox($this->dtgMembers);
         $chkSelect->ActionParameter = $objParticipation->Id;
         $this->chkSelectArray[] = $chkSelect;
         return $chkSelect->Render(false);
     }
 }
Exemplo n.º 5
0
 public function __construct(QFileInfo $fileInfo, QWidget $parent = NULL)
 {
     parent::__construct($parent);
     $permissionsGroup = new QGroupBox(tr("Permissions"));
     $readable = new QCheckBox(tr("Readable"));
     if ($fileInfo->isReadable()) {
         $readable->setChecked(true);
     }
     $writable = new QCheckBox(tr("Writable"));
     if ($fileInfo->isWritable()) {
         $writable->setChecked(true);
     }
     $executable = new QCheckBox(tr("Executable"));
     if ($fileInfo->isExecutable()) {
         $executable->setChecked(true);
     }
     $ownerGroup = new QGroupBox(tr("Ownership"));
     $ownerLabel = new QLabel(tr("Owner"));
     $ownerValueLabel = new QLabel($fileInfo->owner());
     $ownerValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
     $groupLabel = new QLabel(tr("Group"));
     $groupValueLabel = new QLabel($fileInfo->group());
     $groupValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
     $permissionsLayout = new QVBoxLayout();
     $permissionsLayout->addWidget($readable);
     $permissionsLayout->addWidget($writable);
     $permissionsLayout->addWidget($executable);
     $permissionsGroup->setLayout($permissionsLayout);
     $ownerLayout = new QVBoxLayout();
     $ownerLayout->addWidget($ownerLabel);
     $ownerLayout->addWidget($ownerValueLabel);
     $ownerLayout->addWidget($groupLabel);
     $ownerLayout->addWidget($groupValueLabel);
     $ownerGroup->setLayout($ownerLayout);
     $mainLayout = new QVBoxLayout();
     $mainLayout->addWidget($permissionsGroup);
     $mainLayout->addWidget($ownerGroup);
     $mainLayout->addStretch(1);
     $this->setLayout($mainLayout);
 }
Exemplo n.º 6
0
 public function __construct()
 {
     parent::__construct();
     $this->connect($this, SIGNAL('testSignal()'), $this, SLOT('testSlot()'));
     $this->connect($this, SIGNAL('testSignal()'), $this, SLOT('show()'));
     $this->connect($this, SIGNAL('testSignalSignal()'), $this, SIGNAL('clicked()'));
     //		$this->connect( $this, SIGNAL('clicked()'), $this, SLOT('testSlot()') );
     //		$this->connect( $this, SIGNAL('clicked()'), $this, SLOT('toggle()') );
     $this->connect($this, SIGNAL('pressed()'), $this, SIGNAL('testSignalSignal()'));
     $this->connect($this, SIGNAL('released()'), $this, SIGNAL('pressed()'));
     $this->connect($this, SIGNAL('clicked(bool)'), $this, SLOT('setChecked(bool)'));
     $this->slotTester = "";
 }
Exemplo n.º 7
0
 public function chkSelected_Render(Person $objPerson)
 {
     // In order to keep track whether or not a Person's Checkbox has been rendered,
     // we will use explicitly defined control ids.
     $strControlId = 'chkSelected' . $objPerson->Id;
     // Let's see if the Checkbox exists already
     $chkSelected = $this->GetControl($strControlId);
     if (!$chkSelected) {
         // Define the Checkbox -- it's parent is the Datagrid (b/c the datagrid is the one calling
         // this method which is responsible for rendering the checkbox.  Also, we must
         // explicitly specify the control ID
         $chkSelected = new QCheckBox($this->dtgPersons, $strControlId);
         $chkSelected->Text = 'Select';
         // We'll use Control Parameters to help us identify the Person ID being copied
         $chkSelected->ActionParameter = $objPerson->Id;
         // Let's assign a server action on click
         $chkSelected->AddAction(new QClickEvent(), new QServerAction('chkSelected_Click'));
     }
     // Render the checkbox.  We want to *return* the contents of the rendered Checkbox,
     // not display it.  (The datagrid is responsible for the rendering of this column).
     // Therefore, we must specify "false" for the optional blnDisplayOutput parameter.
     return $chkSelected->Render(false);
 }
Exemplo n.º 8
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case 'Disabled':
             try {
                 $this->blnDisabled = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'disabled', $this->blnDisabled);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Icons':
             $this->mixIcons = $mixValue;
             if ($this->OnPage) {
                 $this->CallJqUiMethod(true, 'option', 'icons', $mixValue);
             }
             break;
         case 'Label':
             try {
                 $this->strLabel = QType::Cast($mixValue, QType::String);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'label', $this->strLabel);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'JqText':
             try {
                 $this->blnJqText = QType::Cast($mixValue, QType::Boolean);
                 if ($this->OnPage) {
                     $this->CallJqUiMethod(true, 'option', 'text', $this->blnJqText);
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Enabled':
             $this->Disabled = !$mixValue;
             // Tie in standard QCubed functionality
             parent::__set($strName, $mixValue);
             break;
         default:
             try {
                 parent::__set($strName, $mixValue);
                 break;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 public function RenderSelectGroup(GrowthGroup $objGrowthGroup)
 {
     $strControlId = 'SelectGrpBtn' . $objGrowthGroup->GroupId;
     $rbtnSelected = $this->objForm->GetControl($strControlId);
     if (!$rbtnSelected) {
         $rbtnSelected = new QCheckBox($this->dtgGroups, $strControlId);
         $rbtnSelected->Text = '';
         $rbtnSelected->ActionParameter = $objGrowthGroup->GroupId;
         $rbtnSelected->Checked = false;
         $this->rbtnSelectArray[] = $rbtnSelected;
     }
     return $rbtnSelected->Render(false);
 }
 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);
 }
Exemplo n.º 11
0
 public function chkSelected_Render(Person $objPerson, QCheckBox $chkSelected)
 {
     // Let's assign a server action on click
     $chkSelected->AddAction(new QClickEvent(), new QServerAction('chkSelected_Click'));
 }
Exemplo n.º 12
0
 private function createRootItemWidget($property, $object, $tree, $itemIndex)
 {
     $widget = null;
     switch ($property['type']) {
         case 'mixed':
         case 'int':
             $widget = new QLineEdit();
             if (isset($property['value']) && !$defaultPropertiesLoaded) {
                 $widget->text = $property['value'];
             } else {
                 $widget->text = $object->{$property}['property'];
             }
             // set validator if section exists
             if (isset($property['validator'])) {
                 $widget->setRegExpValidator($property['validator']);
             } else {
                 // if property type is `int` and validator section not exists,
                 // then set a default validator for integers
                 if ($property['type'] == 'int') {
                     $widget->setRegExpValidator('[0-9]*');
                 }
             }
             $widget->connect(SIGNAL('textChanged(QString)'), $this, SLOT('setObjectProperty(QString)'));
             break;
         case 'bool':
             $widget = new QCheckBox();
             if (isset($property['value']) && !$defaultPropertiesLoaded) {
                 $widget->checked = $property['value'];
             } else {
                 $widget->checked = $object->{$property}['property'];
             }
             $widget->connect(SIGNAL('toggled(bool)'), $this, SLOT('setObjectProperty(bool)'));
             break;
         case 'combo-list':
             foreach ($property['list'] as $listItemProperty) {
                 $childItemIndex = $tree->addItem($itemIndex, $listItemProperty['title']);
                 $childItemWidget = $this->createRootItemWidget($listItemProperty, $object, $tree, $itemIndex);
                 if ($childItemWidget != null) {
                     $childItemWidget->__pq_property_ = $property['property'];
                     $childItemWidget->__pq_propertyType_ = $property['type'];
                     $childItemWidget->objectName = "__pq_property_combo_" . $property['property'] . "_" . $listItemProperty['property'];
                     $tree->setItemWidget($childItemIndex, 1, $childItemWidget);
                 }
             }
             break;
         case 'combo':
             $widget = new QComboBox();
             if (isset($property['list']) && is_array($property['list'])) {
                 $index = 0;
                 foreach ($property['list'] as $list) {
                     if (isset($list['title']) && isset($list['value'])) {
                         $cPropertyValue = "cPropertyValue_{$index}";
                         $qvalue = "__pq_property_qvalue_{$index}";
                         $widget->addItem($list['title']);
                         $widget->{$cPropertyValue} = $list['value'];
                         $widget->{$qvalue} = $list['qvalue'];
                         if (isset($property['defaultIndex'])) {
                             $widget->currentIndex = $property['defaultIndex'];
                         }
                         $index++;
                     }
                 }
             }
             $widget->connect(SIGNAL('currentIndexChanged(int)'), $this, SLOT('setObjectProperty(int)'));
             break;
     }
     return $widget;
 }
 /**
  * PHP __set magic method implementation
  *
  * @param string $strName  Name of the property
  * @param string $mixValue Value of the property
  *
  * @return mixed
  * @throws Exception|QCallerException|QInvalidCastException
  */
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case "GroupName":
             try {
                 $strGroupName = QType::Cast($mixValue, QType::String);
                 if ($this->strGroupName != $strGroupName) {
                     $this->strGroupName = $strGroupName;
                     $this->blnModified = true;
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "Checked":
             try {
                 $val = QType::Cast($mixValue, QType::Boolean);
                 if ($val != $this->blnChecked) {
                     $this->blnChecked = $val;
                     if ($this->GroupName && $val == true) {
                         QApplication::ExecuteJsFunction('qcubed.setRadioInGroup', $this->strControlId);
                     } else {
                         $this->AddAttributeScript('prop', 'checked', $val);
                         // just set the one radio
                     }
                 }
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
 /**
  * If this control is attachable to a codegenerated control in a ModelConnector, this function will be
  * used by the ModelConnector designer dialog to display a list of options for the control.
  * @return QModelConnectorParam[]
  **/
 public static function GetModelConnectorParams()
 {
     return array_merge(parent::GetModelConnectorParams(), array(new QModelConnectorParam(get_called_class(), 'Disabled', 'Disables the button if set to true.', QType::Boolean), new QModelConnectorParam(get_called_class(), 'Label', 'Text to show in the button. When not specified (null), the elementsHTML content is used, or its value attribute if the element is aninput element of type submit or reset, or the HTML content of theassociated label element if the element is an input of type radio orcheckbox.', QType::String), new QModelConnectorParam(get_called_class(), 'JqText', 'Whether to show the label. When set to false no text will bedisplayed, but the icons option must be enabled, otherwise the textoption will be ignored.', QType::Boolean)));
 }
Exemplo n.º 15
0
 protected function chkCustom_Create()
 {
     $intRoleId = QApplication::QueryString('intRoleId');
     $objCustomFieldArray = CustomField::LoadObjCustomFieldArray($this->intEntityQtypeId, false, null);
     foreach ($objCustomFieldArray as $objCustomField) {
         //For each Custom Field, we setup one checkbox for View Access and one for Edit Access
         $chkCustomView = new QCheckBox($this);
         $chkCustomView->AddAction(new QClickEvent(), new QAjaxAction('chkCustom_Click'));
         $chkCustomEdit = new QCheckBox($this);
         //When we click in a View Checkbox, we need to control the Edit Checkbox Control too in the chkCustom_Click method.
         $chkCustomView->ActionParameter = $chkCustomEdit->ControlId;
         //In order to manipulate the RoleEntityQtypeCustomFieldAuthorization table, we need to obtain the EntityQtypeCustomFieldId field.
         $objEntityQtypeCustomField = EntityQtypeCustomField::LoadByEntityQtypeIdCustomFieldId($this->intEntityQtypeId, $objCustomField->CustomFieldId);
         if ($objEntityQtypeCustomField) {
             $objCustomAuthView = RoleEntityQtypeCustomFieldAuthorization::LoadByRoleIdEntityQtypeCustomFieldIdAuthorizationId($intRoleId, $objEntityQtypeCustomField->EntityQtypeCustomFieldId, 1);
             //If Creation Mode, the View Privilege of the Custom Fields is checked by default
             if (!$this->blnEditMode) {
                 $chkCustomView->Checked = 1;
             } elseif (isset($objCustomAuthView)) {
                 $chkCustomView->Checked = $objCustomAuthView->AuthorizedFlag;
             }
             $objCustomAuthEdit = RoleEntityQtypeCustomFieldAuthorization::LoadByRoleIdEntityQtypeCustomFieldIdAuthorizationId($intRoleId, $objEntityQtypeCustomField->EntityQtypeCustomFieldId, 2);
             //If Creation Mode, the Edit Privilege of the Custom Fields is checked by default
             if (!$this->blnEditMode) {
                 $chkCustomEdit->Checked = 1;
             } elseif (isset($objCustomAuthEdit)) {
                 $chkCustomEdit->Checked = $objCustomAuthEdit->AuthorizedFlag;
             }
             //if view access is not authorized, edit access won't be authorized
             if (!$chkCustomView->Checked) {
                 $chkCustomEdit->Enabled = false;
                 $chkCustomEdit->Checked = false;
             }
         }
         //In order to manipulate all the custom checkbox of the entity, we save them in an associated array.
         $this->arrCustomChecks[] = array('name' => $objCustomField->ShortDescription . ':', 'view' => $chkCustomView, 'edit' => $chkCustomEdit, 'id' => $objCustomField->CustomFieldId);
     }
 }
Exemplo n.º 16
0
 public function chkSelected_Render($intId)
 {
     $strControlId = 'chkSelected' . $intId . 'x' . $this->ControlId;
     // Let's see if the Checkbox exists already
     $chkSelected = $this->objForm->GetControl($strControlId);
     if (!$chkSelected) {
         $chkSelected = new QCheckBox($this, $strControlId);
         // We'll use Control Parameters to help us identify the Person ID being copied
         $chkSelected->ActionParameter = $intId;
         if ($this->chkSelectAll->Checked) {
             $chkSelected->Checked = true;
         }
     }
     return $chkSelected->Render(false);
 }
Exemplo n.º 17
0
 public function dtgLanguage_ActiveColumn_Render(NarroLanguage $objLanguage)
 {
     if ($objLanguage->LanguageId == QApplication::$SourceLanguage->LanguageId || $objLanguage->LanguageId == QApplication::GetLanguageId()) {
         return '';
     }
     $objCheckBox = $this->Form->GetControl('activelang' . $objLanguage->LanguageId);
     if (!$objCheckBox instanceof QCheckBox) {
         $objCheckBox = new QCheckBox($this->dtgLanguage, 'activelang' . $objLanguage->LanguageId);
         $objCheckBox->ActionParameter = $objLanguage->LanguageId;
         if (QApplication::$UseAjax) {
             $objCheckBox->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'chkActive_Click'));
         } else {
             $objCheckBox->AddAction(new QClickEvent(), new QServerControlAction($this, 'chkActive_Click'));
         }
     }
     $objCheckBox->Checked = $objLanguage->Active;
     return $objCheckBox->Render(false);
 }