function change_password_changepwd1_OnValidate(&$sender) { $change_password_changepwd1_OnValidate = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $change_password; //Compatibility //End change_password_changepwd1_OnValidate //Custom Code @13-2A29BDB7 // ------------------------- if ($change_password->changepwd1->newpwd->GetValue() != $change_password->changepwd1->confirmpwd->GetValue()) { $change_password->changepwd1->Errors->addError("New Password and Confirm Password Mismatch!"); return; } $db = new clsDBconnection1(); $sqll = "select user_password from users where user_id =" . ccgetuserid(); $db->query($sqll); $Result = $db->next_record(); $upwd = $db->f('user_password'); if ($Result and $change_password->changepwd1->oldpwd->GetValue() != $upwd) { $change_password->changepwd1->Errors->addError("Old Password is incorrect!"); return; } // ------------------------- //End Custom Code //Close change_password_changepwd1_OnValidate @8-91FAC17C return $change_password_changepwd1_OnValidate; }
function Show() { $Tpl =& CCGetTemplate($this); global $CCSLocales; if (!$this->Visible) { return; } $this->RowNumber = 0; $this->DataSource->Parameters["expr23"] = ccgetuserid(); $this->DataSource->Parameters["urlresult_id"] = CCGetFromGet("result_id", NULL); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this); $this->DataSource->Prepare(); $this->DataSource->Open(); $this->HasRecord = $this->DataSource->has_next_record(); $this->IsEmpty = !$this->HasRecord; $this->Attributes->Show(); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this); if (!$this->Visible) { return; } $GridBlock = "Grid " . $this->ComponentName; $ParentPath = $Tpl->block_path; $Tpl->block_path = $ParentPath . "/" . $GridBlock; if (!$this->IsEmpty) { $this->ControlsVisible["patient_id"] = $this->patient_id->Visible; $this->ControlsVisible["surname"] = $this->surname->Visible; $this->ControlsVisible["other_names"] = $this->other_names->Visible; $this->ControlsVisible["age"] = $this->age->Visible; $this->ControlsVisible["sex"] = $this->sex->Visible; $this->ControlsVisible["occupation"] = $this->occupation->Visible; $this->ControlsVisible["appointment_time"] = $this->appointment_time->Visible; $this->ControlsVisible["status"] = $this->status->Visible; $this->ControlsVisible["result_id"] = $this->result_id->Visible; while ($this->ForceIteration || $this->RowNumber < $this->PageSize && ($this->HasRecord = $this->DataSource->has_next_record())) { $this->RowNumber++; if ($this->HasRecord) { $this->DataSource->next_record(); $this->DataSource->SetValues(); } $Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row"; $this->patient_id->SetValue($this->DataSource->patient_id->GetValue()); $this->surname->SetValue($this->DataSource->surname->GetValue()); $this->other_names->SetValue($this->DataSource->other_names->GetValue()); $this->age->SetValue($this->DataSource->age->GetValue()); $this->sex->SetValue($this->DataSource->sex->GetValue()); $this->occupation->SetValue($this->DataSource->occupation->GetValue()); $this->appointment_time->SetValue($this->DataSource->appointment_time->GetValue()); $this->status->SetValue($this->DataSource->status->GetValue()); $this->result_id->SetValue($this->DataSource->result_id->GetValue()); $this->Attributes->SetValue("rowNumber", $this->RowNumber); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow", $this); $this->Attributes->Show(); $this->patient_id->Show(); $this->surname->Show(); $this->other_names->Show(); $this->age->Show(); $this->sex->Show(); $this->occupation->Show(); $this->appointment_time->Show(); $this->status->Show(); $this->result_id->Show(); $Tpl->block_path = $ParentPath . "/" . $GridBlock; $Tpl->parse("Row", true); } } else { // Show NoRecords block if no records are found $this->Attributes->Show(); $Tpl->parse("NoRecords", false); } $errors = $this->GetErrors(); if (strlen($errors)) { $Tpl->replaceblock("", $errors); $Tpl->block_path = $ParentPath; return; } $Tpl->parse(); $Tpl->block_path = $ParentPath; $this->DataSource->close(); }
function getUserName() { $db = new clsDBconnection1(); $sql1 = "select first_name from users where user_id=" . ccgetuserid(); $sql2 = "select last_name from users where user_id=" . ccgetuserid(); $sql3 = "select title from title inner join users on title.title_id=users.title_id where users.user_id=" . ccgetuserid(); $db->query($sql1); $Result1 = $db->next_record(); $firstName = $db->f('first_name'); $db->query($sql2); $Result2 = $db->next_record(); $lastName = $db->f('last_name'); $db->query($sql3); $Result3 = $db->next_record(); $title = $db->f('title'); if ($Result1 or $Result2 or $Result3) { return $title . " " . $firstName . " " . $lastName; } }