public function onLoad($param) { date_default_timezone_set('Europe/Berlin'); $this->setUserStartId($this->user->getStartNode($this->user->getUserId($this->user->Name), "tm_activity")); if (!$this->isPostBack && !$this->isCallback) { $this->edidta_activity_type->DataSource = PFH::build_SQLPullDown(ActivityTypeRecord::finder(), "ta_activity_type", array("idta_activity_type", "act_type_name")); $this->edidta_activity_type->dataBind(); $this->ttedidtt_ziele->DataSource = PFH::build_SQLPullDown(TTZieleRecord::finder(), "tt_ziele", array("idtt_ziele", "ttzie_name")); $this->ttedidtt_ziele->dataBind(); //los interfaces input $this->ttedidtm_inoutput->DataSource = PFH::build_SQLPullDown(ActivityInoutputView::finder(), "vv_activity_inoutput", array("idtm_inoutput", "ino_name"), "ino_link_type=0"); $this->ttedidtm_inoutput->dataBind(); //los interfaces $this->Iedidta_inoutput_type->DataSource = PFH::build_SQLPullDown(InoutputTypeRecord::finder(), "ta_inoutput_type", array("idta_inoutput_type", "ino_type_name")); $this->Iedidta_inoutput_type->dataBind(); $Usersql = "SELECT idtm_user, user_name FROM tm_user"; $Userdata = PFH::convertdbObjectArray(UserRecord::finder()->findAllBySql($Usersql), array("idtm_user", "user_name")); $this->idtm_user->DataSource = $Userdata; $this->idtm_user->dataBind(); $this->loadBerechtigung(); $this->CCProtokollDetailGroupListPageSize->DataSource = array(5 => "5", 10 => "10", 15 => "15", 20 => "20"); $this->CCProtokollDetailGroupListPageSize->dataBind(); $this->CCProtokollDetailGroupListPageSize->Text = "5"; $this->CBAufgabeDone->DataSource = $this->auf_done; $this->CBAufgabeDone->dataBind(); $this->CBidta_organisation_art->DataSource = $this->idta_organisation_art; $this->CBidta_organisation_art->dataBind(); $data = array(0 => "Normalfolge(E/A)", 1 => "Anfangsfolge(A/A)", 2 => "Sprungfolge(A/E)", 3 => "Endfolge(E/E)"); $this->edactact_type->DataSource = $data; $this->edactact_type->dataBind(); $this->getPage()->getClientScript()->registerEndScript('XACTCF', "constructCollapsableFieldsets();"); $this->generateZeitVerlaufImage(0); } }
public function onInit($param) { parent::onInit($param); //Globale definition f�r dieses Dokument $this->finder = StrukturRecord::finder(); $this->MASTERRECORD = new StrukturRecord(); if (!$this->isPostBack && !$this->isCallback) { switch ($this->Request['modus']) { case 0: $sql = "SELECT idta_struktur_type, struktur_type_name FROM ta_struktur_type"; $data = PFH::convertdbObjectArray(StrukturTypeRecord::finder()->findAllBySql($sql), array("idta_struktur_type", "struktur_type_name")); $this->idta_struktur_type->DataSource = $data; $this->idta_struktur_type->dataBind(); $HRKEYTest = new PFHierarchyPullDown(); $HRKEYTest->setStructureTable("tm_struktur"); $HRKEYTest->setRecordClass(StrukturRecord::finder()); $HRKEYTest->setPKField("idtm_struktur"); $HRKEYTest->setField("struktur_name"); $HRKEYTest->letsrun(); $this->parent_idtm_struktur->DataSource = $HRKEYTest->myTree; $this->parent_idtm_struktur->dataBind(); $this->idtm_stammdaten->DataSource = PFH::build_SQLPullDown(StammdatenRecord::finder(), "tm_stammdaten", array("idtm_stammdaten", "stammdaten_name")); $this->idtm_stammdaten->dataBind(); break; case 1: $sql = "SELECT idta_struktur_type, struktur_type_name FROM ta_struktur_type"; $data = PFH::convertdbObjectArray(StrukturTypeRecord::finder()->findAllBySql($sql), array("idta_struktur_type", "struktur_type_name")); $this->edidta_struktur_type->DataSource = $data; $this->edidta_struktur_type->dataBind(); if ($this->Request[$this->primarykey] != 1) { $HRKEYTest = new PFHierarchyPullDown(); $HRKEYTest->setStructureTable("tm_struktur"); $HRKEYTest->setRecordClass(StrukturRecord::finder()); $HRKEYTest->setPKField("idtm_struktur"); $HRKEYTest->setField("struktur_name"); $HRKEYTest->letsrun(); $data = $HRKEYTest->myTree; } else { $data = array(); $data[0] = "START"; } $this->edparent_idtm_struktur->DataSource = $data; $this->edparent_idtm_struktur->dataBind(); $this->fillValues($this->getSelected($this->Request[$this->primarykey])); $this->edidtm_stammdaten->DataSource = PFH::build_SQLPullDown(StammdatenRecord::finder(), "tm_stammdaten", array("idtm_stammdaten", "stammdaten_name")); $this->edidtm_stammdaten->dataBind(); $Usersql = "SELECT idtm_user, user_name FROM tm_user"; $Userdata = PFH::convertdbObjectArray(UserRecord::finder()->findAllBySql($Usersql), array("idtm_user", "user_name")); $this->idtm_user->DataSource = $Userdata; $this->idtm_user->dataBind(); $this->loadBerechtigung(); break; default: break; } $this->viewPanel->ActiveViewIndex = $this->Request['modus']; $this->StrukturStammdatenGroupContainer->RCedidtm_struktur->Text = $this->Request[$this->primarykey]; } }
/** * Deletes a specified user record. * This method responds to the datagrid's OnDeleteCommand event. * @param TDataGrid the event sender * @param TDataGridCommandEventParameter the event parameter */ public function deleteButtonClicked($sender, $param) { // obtains the datagrid item that contains the clicked delete button $item = $param->Item; // obtains the primary key corresponding to the datagrid item $username = $this->UserGrid->DataKeys[$item->ItemIndex]; // deletes the user record with the specified username primary key UserRecord::finder()->deleteByPk($username); }
public function buildStammdatenGroupPullDown() { $this->RCedidta_struktur_type->DataSource = PFH::build_SQLPullDown(StrukturTypeRecord::finder(), "ta_struktur_type", array("idta_struktur_type", "struktur_type_name")); $this->RCedidta_struktur_type->dataBind(); $Usersql = "SELECT idtm_user, user_name FROM tm_user"; $Userdata = PFH::convertdbObjectArray(UserRecord::finder()->findAllBySql($Usersql), array("idtm_user", "user_name")); $this->idtm_user->DataSource = $Userdata; $this->idtm_user->dataBind(); }
public function getUserId($username = '') { if ($username == '') { $userRecord = UserRecord::finder()->find('user_username = ?', $this->Name); } else { $userRecord = UserRecord::finder()->find('user_username = ?', $username); } if (is_Object($userRecord)) { return $userRecord->idtm_user; } else { return 0; } }
function test_Create_new_user_returns_true() { $user = new UserRecord(); $user->username = '******'; $user->password = md5('asd'); $user->email = 'asdasd'; $user->first_name = 'wei'; $user->last_name = 'zhuo'; $this->assertTrue($user->save()); $user->password = md5('more'); $this->assertTrue($user->save()); $check = UserRecord::finder()->findByPk('hello'); $this->assertSameUser($user, $check); $this->assertTrue($user->delete()); }
public function onLoad($param) { parent::onLoad($param); date_default_timezone_set('Europe/Berlin'); //$this->SBedidta_struktur_type->Text = $this->page->idta_struktur_type->Text; if (!$this->page->isPostBack && !$this->page->isCallback) { //$this->buildStrukturBerichtPullDown(); $this->bindListStrukturBerichtValue(); $this->buildStrukturBerichtZeilenPullDown(); $this->buildStrukturBerichtSpaltenPullDown(); $Usersql = "SELECT idtm_user, user_name FROM tm_user"; $Userdata = PFH::convertdbObjectArray(UserRecord::finder()->findAllBySql($Usersql), array("idtm_user", "user_name")); $this->idtm_user->DataSource = $Userdata; $this->idtm_user->dataBind(); } }
/** * Returns the user data to be editted. * @return UserRecord the user data to be editted. * @throws THttpException if the user data is not found. */ protected function getUserRecord() { // the user to be editted is the currently logged-in user $username = $this->User->Name; // if the 'username' GET var is not empty and the current user // is an administrator, we use the GET var value instead. if ($this->User->IsAdmin && $this->Request['username'] !== null) { $username = $this->Request['username']; } // use Active Record to look for the specified username $userRecord = UserRecord::finder()->findByPk($username); if (!$userRecord instanceof UserRecord) { throw new THttpException(500, 'Username is invalid.'); } return $userRecord; }
public function onLoad($param) { parent::onLoad($param); if (!$this->page->IsPostBack && !$this->page->IsCallback) { $PeriodPullDown = new PFPeriodPullDown(); $PeriodPullDown->setStructureTable("ta_perioden"); $PeriodPullDown->setRecordClass(PeriodenRecord::finder()); $PeriodPullDown->setPKField("idta_perioden"); $PeriodPullDown->setField("per_extern"); $PeriodPullDown->letsrun(); $this->RCedidta_perioden->DataSource = $PeriodPullDown->myTree; $this->RCedidta_perioden->dataBind(); $Usersql = "SELECT idtm_user, user_name FROM tm_user"; $Userdata = PFH::convertdbObjectArray(UserRecord::finder()->findAllBySql($Usersql), array("idtm_user", "user_name")); $this->var_idtm_user->DataSource = $Userdata; $this->var_idtm_user->dataBind(); $this->bindListVariantenValue(); } }
public function changePassword2($sender, $param) { $finder = UserRecord::finder(); $finder->DbConnection->Active = true; $transaction = $finder->DbConnection->beginTransaction(); try { $baseMethod = new BaseFunction(); $hash = $this->getRequest()->itemAt("amp;hash"); if ($this->getRequest()->contains("amp;hash") == false) { $hash = $this->getRequest()->itemAt("hash"); } $rows = $finder->findByUsername($hash); $rows->Password = TPropertyValue::ensureString($baseMethod->cryptString($this->ConfirmPassword->getSafeText())); $rows->save(); $transaction->commit(); } catch (Exception $e) { print_R($e->getMessage()); $transaction->rollBack(); } $this->Response->redirect($this->Service->constructUrl("Login")); }
public function editRow($sender, $param) { if ($this->IsValid) { $baseMethod = new BaseFunction(); $qty = UserRecord::finder()->count(); if (UserRecord::finder()->findByName($this->Login->getSafeText())) { $this->InCorrect->Visible = true; } else { $rows = new UserRecord(); $rows->Username = $baseMethod->cryptString($this->Login->getSafeText()); $rows->Email = $baseMethod->cryptString($this->Login->getSafeText()); $rows->Password = $baseMethod->cryptString($this->Password->getSafeText()); $rows->Role = 0; $rows->PagesID = $this->getRequest()->itemAt("id"); $rows->Name = $this->Login->getSafeText(); $rows->ID = $qty + 1; $rows->save(); $this->Response->redirect($this->Service->constructUrl("User.Index", array("id" => $this->getRequest()->itemAt("id")))); } } }
public function validateUser($username, $password) { $baseMethod = new BaseFunction(); return UserRecord::finder()->findBy_Username_AND_Password($baseMethod->cryptString($username), $baseMethod->cryptString($password)); }
/** * Checks whether the username exists in the database. * This method responds to the OnServerValidate event of username's custom validator. * @param mixed event sender * @param mixed event parameter */ public function checkUsername($sender, $param) { // valid if the username is not found in the database $param->IsValid = UserRecord::finder()->findByPk($this->Username->Text) === null; }
public function bind_lstUser() { $this->lstUser->DataSource = UserRecord::finder()->findAll(); $this->lstUser->dataBind(); }
private function cryptPassword() { $baseMethod = new BaseFunction(); return UserRecord::finder()->findByUsername_AND_Email($baseMethod->cryptString($this->Username->getSafeText()), $baseMethod->cryptString($this->Email->getSafeText())); }
public function view_Organisation($idtm_organisation) { $myitem = OrganisationRecord::finder()->findByPK($idtm_organisation); $tempus = 'RCed' . $this->RCprimarykey; $monus = $this->RCprimarykey; $this->{$tempus}->Text = $myitem->{$monus}; $this->bindListAdress(); $this->bindListKom(); $this->viewMainAdress($idtm_organisation); //HIDDEN foreach ($this->RChiddenfields as $recordfield) { $edrecordfield = 'RCed' . $recordfield; $this->{$edrecordfield}->setText($myitem->{$recordfield}); } //DATUM foreach ($this->RCdatfields as $recordfield) { $edrecordfield = 'RCed' . $recordfield; $this->{$edrecordfield}->setDate($myitem->{$recordfield}); } //BOOL foreach ($this->RCboolfields as $recordfield) { $edrecordfield = 'RCed' . $recordfield; $this->{$edrecordfield}->setChecked($myitem->{$recordfield}); } //TIME foreach ($this->RCtimefields as $recordfield) { $edrecordfield = 'RCed' . $recordfield; $my_time = explode(':', $myitem->{$recordfield}); $my_time_text = $my_time[0] . ':' . $my_time[1]; $this->{$edrecordfield}->Text = $my_time_text; } //NON DATUM foreach ($this->RCfields as $recordfield) { $edrecordfield = 'RCed' . $recordfield; $this->{$edrecordfield}->Text = $myitem->{$recordfield}; } $this->RCedorganisation_edit_status->Text = 1; $ActualUser = UserRecord::finder()->findByidtm_user($this->RCedidtm_user->Text); if (is_Object($ActualUser)) { $this->suggest_idtm_user->Text = $ActualUser->user_username; } else { $this->suggest_idtm_user->Text = 0; } $this->loadBankkonto($this->{$tempus}->Text); $this->loadObjekt($this->{$tempus}->Text); $this->laborg_name->Text = $myitem->org_name; $ParentOrga = OrganisationRecord::finder()->findByidtm_organisation($myitem->parent_idtm_organisation); if (is_Object($ParentOrga)) { $this->labparentorg_name->Text = $ParentOrga->org_name . ', ' . $ParentOrga->org_vorname; } $this->labparentorg_name->CommandParameter = $myitem->parent_idtm_organisation; //Rechnungen //$this->Teddeb_id->Text = $myitem->$monus; //$this->Teddeb_tabelle->Text = 'tm_zeiterfassung'; //$this->RechnungContainer->initParameters(); $this->RechnungContainer->bindRechnungListe(); //TASKPART $this->Tedsend_id->Text = $myitem->{$monus}; $this->Tedauf_id->Text = $myitem->{$monus}; $this->AufgabenContainerOrganisation->initParameters(); $this->AufgabenContainerOrganisation->initYearPullDown(); $this->AufgabenContainerOrganisation->bindListTAValue(); $this->setPDFSteckbrief($myitem->{$monus}); $this->bindListChildOrgListe(); }
function testFindByPk() { $user1 = UserRecord::finder()->findByPk('admin'); $this->assertNotNull($user1); }
/** * Checks if the specified (username, password) is valid. * This method is required by TDbUser. * @param string username * @param string password * @return boolean whether the username and password are valid. */ public function validateUser($username, $password) { // use UserRecord Active Record to look for the (username, password) pair. return UserRecord::finder()->findBy_username_AND_password($username, $password) !== null; }