Ejemplo n.º 1
0
Archivo: index.php Proyecto: alcf/chms
 public function dtgStaff_Bind()
 {
     $objConditions = QQ::All();
     if ($this->lstMinistry->SelectedValue) {
         $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Login()->Ministry->MinistryId, $this->lstMinistry->SelectedValue));
     }
     if ($this->lstActiveFlag->SelectedValue) {
         $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Login()->DomainActiveFlag, true), QQ::Equal(QQN::Login()->LoginActiveFlag, true));
     } else {
         $objConditions = QQ::AndCondition($objConditions, QQ::OrCondition(QQ::Equal(QQN::Login()->DomainActiveFlag, false), QQ::Equal(QQN::Login()->LoginActiveFlag, false)));
     }
     $this->dtgStaff->TotalItemCount = Login::QueryCount($objConditions);
     // Setup the $objClauses Array
     $objClauses = array();
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->dtgStaff->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgStaff->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from Login, given the clauses above
     $this->dtgStaff->DataSource = Login::QueryArray($objConditions, $objClauses);
 }
Ejemplo n.º 2
0
 protected function Form_Create()
 {
     $this->mctObject = ClassInstructorMetaControl::CreateFromPathInfo($this, QMetaControlCreateType::CreateOnRecordNotFound);
     if ($this->mctObject->EditMode) {
         $this->strPageTitle .= 'Edit Instructor';
     } else {
         $this->strPageTitle .= 'Create New Instructor';
     }
     $this->lstLogin = $this->mctObject->lstLogin_Create(null, QQ::OrCondition(QQ::AndCondition(QQ::IsNull(QQN::Login()->ClassInstructor->Id), QQ::Equal(QQN::Login()->LoginActiveFlag, true), QQ::Equal(QQN::Login()->DomainActiveFlag, true)), QQ::Equal(QQN::Login()->Id, $this->mctObject->ClassInstructor->LoginId)), QQ::OrderBy(QQN::Login()->FirstName, QQN::Login()->LastName));
     $this->txtDisplayName = $this->mctObject->txtDisplayName_Create();
     $this->txtDisplayName->AddAction(new QEnterKeyEvent(), new QTerminateAction());
     $this->btnSave = new QButton($this);
     $this->btnSave->CssClass = 'primary';
     $this->btnSave->Text = $this->mctObject->EditMode ? 'Update' : 'Create';
     $this->btnSave->CausesValidation = true;
     $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click'));
     $this->btnSave->AddAction(new QClickEvent(), new QTerminateAction());
     $this->btnCancel = new QLinkButton($this);
     $this->btnCancel->CssClass = 'cancel';
     $this->btnCancel->Text = 'Cancel';
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
     $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction());
     if ($this->mctObject->EditMode) {
         $this->btnDelete = new QLinkButton($this);
         $this->btnDelete->CssClass = 'delete';
         $this->btnDelete->Text = 'Delete';
         $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to PERMANENTLY DELETE this?'));
         $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click'));
         $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction());
     }
 }
Ejemplo n.º 3
0
 protected function Form_Create()
 {
     $this->dtgBatches = new StewardshipBatchDataGrid($this);
     $this->dtgBatches->FontSize = '10px';
     $this->dtgBatches->Paginator = new QPaginator($this->dtgBatches);
     $this->dtgBatches->MetaAddColumn('DateEntered', 'Name=Batch Label', 'Html=<?= $_FORM->RenderBatchLabel($_ITEM); ?>', 'HtmlEntities=false', 'Width=100px');
     $this->dtgBatches->MetaAddColumn('DateCredited', 'Name=Post Date', 'Html=<?= $_FORM->RenderPostDate($_ITEM); ?>', 'HtmlEntities=false', 'Width=80px');
     $this->dtgBatches->MetaAddTypeColumn('StewardshipBatchStatusTypeId', 'StewardshipBatchStatusType', 'Name=Status', 'Width=80px');
     $this->dtgBatches->MetaAddColumn('Description', 'Width=210px');
     $this->dtgBatches->MetaAddColumn('ItemCount', 'Name=Items', 'Width=40px');
     $this->dtgBatches->MetaAddColumn('ActualTotalAmount', 'Name=Total', 'Html=<?= $_FORM->FormatNumber($_ITEM->ActualTotalAmount); ?>', 'Width=85px', 'HtmlEntities=false');
     $this->dtgBatches->MetaAddColumn('ReportedTotalAmount', 'Name=Reported', 'Html=<?= $_FORM->FormatNumber($_ITEM->ReportedTotalAmount); ?>', 'Width=85px', 'HtmlEntities=false');
     $this->dtgBatches->MetaAddColumn('PostedTotalAmount', 'Name=Posted', 'Html=<?= $_FORM->FormatNumber($_ITEM->PostedTotalAmount); ?>', 'Width=85px', 'HtmlEntities=false');
     $this->dtgBatches->MetaAddColumn(QQN::StewardshipBatch()->CreatedByLogin->LastName, 'Name=Created By', 'Html=<?= ($_ITEM->CreatedByLogin->Name); ?>', 'Width=100px');
     $this->dtgBatches->SetDataBinder('dtgBatches_Bind');
     $this->dtgBatches->SortColumnIndex = 0;
     $this->dtgBatches->SortDirection = 1;
     $this->txtDescription = new QTextBox($this);
     $this->lstStatus = new QListBox($this);
     $this->lstStatus->AddItem('- View All -');
     foreach (StewardshipBatchStatusType::$NameArray as $intId => $strName) {
         $this->lstStatus->AddItem($strName, $intId);
     }
     $this->lstCreatedBy = new QListBox($this);
     $this->lstCreatedBy->AddItem('- View All -');
     foreach (Login::LoadAll(QQ::OrderBy(QQN::Login()->LastName)) as $objLogin) {
         $this->lstCreatedBy->AddItem($objLogin->Name, $objLogin->Id);
     }
     $this->txtDescription->AddAction(new QEnterKeyEvent(), new QAjaxAction('ResetFilter'));
     $this->txtDescription->AddAction(new QEnterKeyEvent(), new QTerminateAction());
     $this->txtDescription->AddAction(new QChangeEvent(), new QAjaxAction('ResetFilter'));
     $this->lstStatus->AddAction(new QChangeEvent(), new QAjaxAction('ResetFilter'));
     $this->lstCreatedBy->AddAction(new QChangeEvent(), new QAjaxAction('ResetFilter'));
 }
Ejemplo n.º 4
0
 public function testEmptyColumns()
 {
     $objItem = Login::QuerySingle(QQ::Equal(QQN::Login()->Id, 1));
     $this->assertTrue($objItem->IsEnabled === 0, "Zero column does not return null.");
     $objItem = Project::QuerySingle(QQ::Equal(QQN::Project()->Id, 2));
     $this->assertTrue($objItem->EndDate === null, "Null date column returns a null.");
 }
Ejemplo n.º 5
0
 public function testEmptyColumns()
 {
     $objItem = Login::QuerySingle(QQ::Equal(QQN::Login()->Id, 1));
     $var = $objItem->IsEnabled;
     $this->assertNotNull($var, "Zero column does not return null. ");
     $this->assertTrue($var == 0, "Zero boolean column is false or zero. ");
     $objItem = Project::QuerySingle(QQ::Equal(QQN::Project()->Id, 2));
     $this->assertTrue($objItem->EndDate === null, "Null date column returns a null.");
     // Testing unique reverse reference on null
     $objPerson = new Person();
     $objLogin = $objPerson->Login;
     $this->assertNull($objLogin, "New record should not be associated with null PK.");
 }
Ejemplo n.º 6
0
Archivo: group.php Proyecto: alcf/chms
 public function lblMinistry_Refresh()
 {
     if ($this->objGroup && $this->lblMinistry->Text != $this->objGroup->Ministry->Name) {
         $this->lblMinistry->Text = QApplication::HtmlEntities($this->objGroup->Ministry->Name);
         $strLoginNameArray = array();
         foreach ($this->objGroup->Ministry->GetLoginArray(QQ::OrderBy(QQN::Login()->FirstName)) as $objLogin) {
             if ($objLogin->DomainActiveFlag && $objLogin->LoginActiveFlag) {
                 $strLoginNameArray[] = $objLogin->FirstName . ' ' . $objLogin->LastName;
             }
         }
         $this->lblMinistry->Text .= '<br/><span class="subhead">Facilitated by ' . QApplication::HtmlEntities(implode(', ', $strLoginNameArray)) . '</span>';
     }
 }
Ejemplo n.º 7
0
 public function testMultiLeafExpansion()
 {
     $objMilestone = Milestone::QuerySingle(QQ::Equal(QQN::Milestone()->Id, 1), QQ::Clause(QQ::ExpandAsArray(QQN::Milestone()->Project->ManagerPerson->ProjectAsTeamMember), QQ::ExpandAsArray(QQN::Milestone()->Project->PersonAsTeamMember)));
     $objProjectArray = $objMilestone->Project->ManagerPerson->_ProjectAsTeamMemberArray;
     $objPeopleArray = $objMilestone->Project->_PersonAsTeamMemberArray;
     $this->assertTrue(is_array($objProjectArray), "_ProjectAsTeamMemberArray is an array");
     $this->assertEqual(count($objProjectArray), 2, "_ProjectAsTeamMemberArray has 2 Project objects");
     $this->assertTrue(is_array($objPeopleArray), "_PersonAsTeamMemberArray is an array");
     $this->assertEqual(count($objPeopleArray), 5, "_PersonAsTeamMemberArray has 5 People objects");
     // try through a unique relationship
     $objLogin = Login::QuerySingle(QQ::Equal(QQN::Login()->PersonId, 7), QQ::Clause(QQ::ExpandAsArray(QQN::Login()->Person->ProjectAsTeamMember), QQ::ExpandAsArray(QQN::Login()->Person->ProjectAsManager)));
     $objProjectArray = $objLogin->Person->_ProjectAsTeamMemberArray;
     $this->assertTrue(is_array($objProjectArray), "_ProjectAsTeamMemberArray is an array");
     $this->assertEqual(count($objProjectArray), 2, "_ProjectAsTeamMemberArray has 2 Project objects");
     $objProjectArray = $objLogin->Person->_ProjectAsManagerArray;
     $this->assertTrue(is_array($objProjectArray), "_ProjectAsManagerArray is an array");
     $this->assertEqual(count($objProjectArray), 2, "_ProjectAsManagerArray has 2 Project objects");
 }
Ejemplo n.º 8
0
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a Login-based QQNode.
  * It will also verify that it is a proper Login-based QQNode, and will throw an exception otherwise.
  *
  * @param mixed $mixContent
  * @return QQNode
  */
 protected function ResolveContentItem($mixContent)
 {
     if ($mixContent instanceof QQNode) {
         if (!$mixContent->_ParentNode) {
             throw new QCallerException('Content QQNode cannot be a Top Level Node');
         }
         if ($mixContent->_RootTableName == 'login') {
             if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             }
             $objCurrentNode = $mixContent;
             while ($objCurrentNode = $objCurrentNode->_ParentNode) {
                 if (!$objCurrentNode instanceof QQNode) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
                 if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
             }
             return $mixContent;
         } else {
             throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "login".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'Id':
                     return QQN::Login()->Id;
                 case 'RoleTypeId':
                     return QQN::Login()->RoleTypeId;
                 case 'PermissionBitmap':
                     return QQN::Login()->PermissionBitmap;
                 case 'Username':
                     return QQN::Login()->Username;
                 case 'PasswordCache':
                     return QQN::Login()->PasswordCache;
                 case 'PasswordLastSet':
                     return QQN::Login()->PasswordLastSet;
                 case 'DateLastLogin':
                     return QQN::Login()->DateLastLogin;
                 case 'DomainActiveFlag':
                     return QQN::Login()->DomainActiveFlag;
                 case 'LoginActiveFlag':
                     return QQN::Login()->LoginActiveFlag;
                 case 'Email':
                     return QQN::Login()->Email;
                 case 'FirstName':
                     return QQN::Login()->FirstName;
                 case 'MiddleInitial':
                     return QQN::Login()->MiddleInitial;
                 case 'LastName':
                     return QQN::Login()->LastName;
                 case 'ClassInstructor':
                     return QQN::Login()->ClassInstructor;
                 default:
                     throw new QCallerException('Simple Property not found in LoginDataGrid content: ' . $mixContent);
             }
         } else {
             if ($mixContent instanceof QQAssociationNode) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             } else {
                 throw new QCallerException('Invalid Content type');
             }
         }
     }
 }
 public function testConditionalExpansion2()
 {
     $clauses = QQ::Clause(QQ::Expand(QQN::Login()->Person->ProjectAsManager, QQ::Equal(QQN::Login()->Person->ProjectAsManager->ProjectStatusTypeId, ProjectStatusType::Open)), QQ::ExpandAsArray(QQN::Login()->Person->ProjectAsManager->Milestone), QQ::ExpandAsArray(QQN::Login()->Person->Address), QQ::OrderBy(QQN::Login()->Person->Id));
     $cond = QQ::In(QQN::Login()->PersonId, [1, 3, 7]);
     $targetLoginArray = Login::QueryArray($cond, $clauses);
     $targetLogin = reset($targetLoginArray);
     $this->assertEquals($targetLogin->Person->Id, 1, "Person 1 found.");
     $this->assertNotNull($targetLogin->Person->_ProjectAsManager, "Person 1 has an open project.");
     $targetLogin = next($targetLoginArray);
     $this->assertEquals($targetLogin->Person->Id, 3, "Person 3 found.");
     $this->assertNull($targetLogin->Person->_ProjectAsManager, "Person 3 does not have an open project.");
     $targetLogin = next($targetLoginArray);
     $this->assertEquals($targetLogin->Person->Id, 7, "Person 7 found.");
     $this->assertNull($targetLogin->Person->_ProjectAsManager, "Person 7 does have an open project.");
 }
Ejemplo n.º 10
0
 /**
  * Checks to see if an association exists with a specific Ministry
  * @param Ministry $objMinistry
  * @return bool
  */
 public function IsMinistryAssociated(Ministry $objMinistry)
 {
     if (is_null($this->intId)) {
         throw new QUndefinedPrimaryKeyException('Unable to call IsMinistryAssociated on this unsaved Login.');
     }
     if (is_null($objMinistry->Id)) {
         throw new QUndefinedPrimaryKeyException('Unable to call IsMinistryAssociated on this Login with an unsaved Ministry.');
     }
     $intRowCount = Login::QueryCount(QQ::AndCondition(QQ::Equal(QQN::Login()->Id, $this->intId), QQ::Equal(QQN::Login()->Ministry->MinistryId, $objMinistry->Id)));
     return $intRowCount > 0;
 }