public function CloseRightPanel($blnUpdatesMade) { // First, remove all children panels from both pnlRight $this->pnlRight->RemoveChildControls(true); // If Updates were Made, then Re-Draw Left Panel to reflect the changes // Note that this is a "brute force" method to update the entire left panel // Of course, if you want, you can more finely tune this update process by only updating specific // controls, etc., depending on what was updated/changed. if ($blnUpdatesMade) { $this->pnlLeft->RemoveChildControls(true); if ($intProjectId = $this->lstProjects->SelectedValue) { $pnlProjectView = new ProjectViewPanel($this->pnlLeft, Project::Load($intProjectId), $this->pnlRight->ControlId); } } }
protected function SetItemCheckedState($itemId, $blnChecked) { $objProject = Project::Load($itemId); if ($blnChecked) { // Simulate an associating with the project QApplication::DisplayAlert('Associating ' . $objProject->Name); // To actually do the association, we would execute the following: /* $objParentProject = Project::Load(1); // We were associating the ACME project $objParentProject->AssociateProjectAsRelated ($objProject); */ } else { // Simulate unassociating the Project QApplication::DisplayAlert('Unassociating ' . $objProject->Name); } }
<li>CountAll</li> <li>Save</li> <li>Delete</li> </ul> The example below shows how we can use the <b>Load</b> and <b>LoadAll</b> methods and the properties to view some the data. Feel free to <b>View Source</b> to view the PHP code for <b>objects.php</b> which makes these calls. </div> <h3>Displaying the Properties of a Project</h3> <?php // Let's load a project object -- let's select the // project with ID #2 $objProject = Project::Load(2); ?> Project ID: <?php _p($objProject->Id); ?> <br/> Project Name: <?php _p($objProject->Name); ?> <br/> Project Decsription: <?php _p($objProject->Description); ?> <br/> Project Start Date: <?php _p($objProject->StartDate);
// but the Project.class.php code has been pulled out and put here for demonstration // purposes. require __MODEL_GEN__ . '/ProjectGen.class.php'; class Project extends ProjectGen { const TaxPercentage = 0.0825; public function GetPrice($fltDiscount) { $fltPrice = $this->fltBudget; $fltPrice = $fltPrice * (1.0 - $fltDiscount); $fltPrice = $fltPrice * (1.0 + Project::TaxPercentage); return $fltPrice; } } // Let's load a Project object -- let's select the Project with ID #3 $objProject = Project::Load(3); ?> <h2>Load a Project Object and Use the New GetPrice Method</h2> Project ID: <?php _p($objProject->Id); ?> <br/> Project Name: <?php _p($objProject->Name); ?> <br/> Project Budget: $<?php _p($objProject->Budget); ?> <br/>
<ul> <?php foreach ($objPerson->GetProjectAsTeamMemberArray() as $objProject) { _p('<li>' . $objProject->Name . '</li>', false); } ?> </ul> <p>There are <?php _p($objPerson->CountProjectsAsTeamMember()); ?> project(s) that this person is a team member of.</p> <h2>Project's Many-to-Many Relationship with Person (via team_member_project_assn)</h2> <?php // Let's load a Project object -- let's select the Project with ID #1 $objProject = Project::Load(1); ?> <ul class="project-list"> <li>Project ID: <?php _p($objProject->Id); ?> </li> <li>Project Name: <?php _p($objProject->Name); ?> </li> </ul> <h2>Listing of the Person(s) that This Project has as Team Members</h2> <ul> <?php
public function addProject($req) { if ($req->id) { $projectTeamss = new ProjectTeams(); $projectTeamss->Load('project_id = ?', array($req->id)); $projectTeamss->Delete(); $projectss = new Project(); $projectss->Load('id = ?', array($req->id)); $projectss->Delete(); } $req = (array) $req; foreach ($req as $key => $value) { if (strpos($key, 'department') !== false) { $projectTeams['department_id'][] = $value; unset($req[$key]); } if (strpos($key, 'Supervisors') !== false) { $projectTeams['supervisors'][] = $value; unset($req[$key]); } if (strpos($key, 'Members') !== false) { $projectTeams['members'][] = $value; unset($req[$key]); } } $req = (object) $req; $req = $this->cast('Project', $req); $ok = $req->Save(); if (!$ok) { return new IceResponse(IceResponse::ERROR, $req->ErrorMsg()); } else { $projectID = $req->_lastid; for ($i = 0; $i < count($projectTeams['supervisors']); $i++) { $projectTeam = new ProjectTeams(); $projectTeam->project_id = $projectID; $projectTeam->members = $projectTeams['members'][$i]; $projectTeam->supervisors = $projectTeams['supervisors'][$i]; $projectTeam->department_id = $projectTeams['department_id'][$i]; $ok = $projectTeam->Save(); } } if ($ok) { return new IceResponse(IceResponse::SUCCESS, "Project Saved"); } else { return new IceResponse(IceResponse::ERROR, "Error Saving Project"); } }
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd] Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah) */ $moduleName = 'employee_TimeSheet'; define('MODULE_PATH', dirname(__FILE__)); include APP_BASE_PATH . 'header.php'; include APP_BASE_PATH . 'modulejslibs.inc.php'; //custom code $employeeProjects = array(); $allowAllProjects = $settingsManager->getSetting("Projects: Make All Projects Available to Employees"); if ($allowAllProjects == 0) { $employeeProjects = array(); $employeeProjectsTemp = $baseService->get("EmployeeProject"); foreach ($employeeProjectsTemp as $p) { $project = new Project(); $project->Load("id = ?", $p->project); $p->name = $project->name; $employeeProjects[] = $p; } } else { $employeeProjects = $baseService->get("Project"); } ?> <div class="span9"> <ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;"> <li class="active"><a id="tabEmployeeTimeSheetAll" href="#tabPageEmployeeTimeSheetAll">All My TimeSheets</a></li> <li class=""><a id="tabEmployeeTimeSheetApproved" href="#tabPageEmployeeTimeSheetApproved">Approved TimeSheets</a></li> <li class=""><a id="tabEmployeeTimeSheetPending" href="#tabPageEmployeeTimeSheetPending">Pending TimeSheets</a></li> <li class=""><a id="tabSubEmployeeTimeSheetAll" href="#tabPageSubEmployeeTimeSheetAll">Subordinate TimeSheets</a></li> </ul>
protected function lstProjectsAsTeamMember_Update() { $this->objPerson->UnassociateAllProjectsAsTeamMember(); $objSelectedListItems = $this->lstProjectsAsTeamMember->SelectedItems; if ($objSelectedListItems) { foreach ($objSelectedListItems as $objListItem) { $this->objPerson->AssociateProjectAsTeamMember(Project::Load($objListItem->Value)); } } }
public function mouseOver($strFormId, $strControlId, $param) { if ($objProject = Project::Load($param)) { $this->pnlClick->Text = 'You hovered over ' . $objProject->Name; } }
public function testMultiLevel() { $arrPeople = Person::LoadAll(self::getTestClauses()); $this->assertEquals(12, sizeof($arrPeople), "12 Person objects found"); $targetPerson = $this->verifyObjectPropertyHelper($arrPeople, 'LastName', 'Wolfe'); $this->helperVerifyKarenWolfe($targetPerson); $objProjectArray = $targetPerson->_ProjectAsManagerArray; $this->assertEquals(2, sizeof($objProjectArray), "2 projects found"); foreach ($objProjectArray as $objProject) { $objMilestoneArray = $objProject->_MilestoneArray; switch ($objProject->Id) { case 1: $this->assertEquals(3, sizeof($objMilestoneArray), "3 milestones found"); break; case 4: $this->assertEquals(4, sizeof($objMilestoneArray), "4 milestones found"); break; default: $this->assertTrue(false, 'Unexpected project found, id: ' . $objProject->Id); break; } } // Now test a multilevel expansion where first level does not expand by array. Should get duplicate entries at that level. $clauses = QQ::Clause(QQ::ExpandAsArray(QQN::Person()->Address), QQ::Expand(QQN::Person()->ProjectAsManager), QQ::ExpandAsArray(QQN::Person()->ProjectAsManager->Milestone)); $arrPeople = Person::LoadAll($clauses); // Karen Wolfe should duplicate, since she is managing two projects $this->assertEquals(13, sizeof($arrPeople), "13 Person objects found"); $targetPerson = $this->verifyObjectPropertyHelper($arrPeople, 'LastName', 'Wolfe'); $objProjectArray = $targetPerson->_ProjectAsManagerArray; $this->assertNull($objProjectArray, "No project array found"); $objProject = $targetPerson->_ProjectAsManager; $this->assertNotNull($objProject, "Project found"); $objMilestoneArray = $objProject->_MilestoneArray; // since we didn't specify the order, not sure which one we will get, so check for either switch ($objProject->Id) { case 1: $this->assertEquals(3, sizeof($objMilestoneArray), "3 milestones found"); break; case 4: $this->assertEquals(4, sizeof($objMilestoneArray), "4 milestones found"); break; default: $this->assertTrue(false, 'Unexpected project found, id: ' . $objProject->Id); break; } // test that querying for expanded objects will return the cached version $objProject2 = Project::Load($objProject->Id, array(QQ::Select(QQN::Project()->Name))); // even though we only selected a name, we still get the other items in the cached object $this->assertNotNull($objProject2->ManagerPersonId, "ManagerPersonId found"); }