function show_overdue($template_name) { global $db; global $TPL; $current_user =& singleton("current_user"); $db = new db_alloc(); $temp = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $today = date("Y", $temp) . "-" . date("m", $temp) . "-" . date("d", $temp); $q = prepare("SELECT itemName,itemType,item.itemID,dateBorrowed,dateToBeReturned,loan.personID \n FROM loan,item \n WHERE dateToBeReturned < '%s' \n\t\t\t\t\t AND dateReturned = '0000-00-00' \n\t\t\t\t\t AND item.itemID = loan.itemID\n ", $today); if (!have_entity_perm("loan", PERM_READ, $current_user, false)) { $q .= prepare("AND loan.personID = %d", $current_user->get_id()); } $db->query($q); while ($db->next_record()) { $i++; $item = new item(); $loan = new loan(); $item->read_db_record($db); $loan->read_db_record($db); $item->set_values(); $loan->set_values(); $person = new person(); $person->set_id($loan->get_value("personID")); $person->select(); $TPL["person"] = $person->get_name(); $TPL["overdue"] = "<a href=\"" . $TPL["url_alloc_item"] . "itemID=" . $item->get_id() . "&return=true\">Overdue!</a>"; include_template($template_name); } }
function get_recipients() { $db = new db_alloc(); $type = $this->get_value('reminderType'); if ($type == "project") { $query = prepare("SELECT * \n FROM projectPerson \n LEFT JOIN person ON projectPerson.personID=person.personID \n WHERE projectPerson.projectID = %d \n ORDER BY person.username", $this->get_value('reminderLinkID')); } else { if ($type == "task") { // Modified query option: to send to all people on the project that this task is from. $recipients = array("-3" => "Task Manager", "-2" => "Task Assignee"); $db->query("SELECT projectID FROM task WHERE taskID = %d", $this->get_value('reminderLinkID')); $db->next_record(); if ($db->f('projectID')) { $query = prepare("SELECT * \n FROM projectPerson \n LEFT JOIN person ON projectPerson.personID=person.personID \n WHERE projectPerson.projectID = %d \n ORDER BY person.username", $db->f('projectID')); } else { $query = "SELECT * FROM person WHERE personActive = 1 ORDER BY username"; } } else { $query = "SELECT * FROM person WHERE personActive = 1 ORDER BY username"; } } $db->query($query); while ($db->next_record()) { $person = new person(); $person->read_db_record($db); $recipients[$person->get_id()] = $person->get_name(); } return $recipients; }
/** * clone a phone object in under a person object * * @param person $person http://www.test.com/info (comment) * @param phone $phone http://www.test.com/info (comment) * @return person http://www.test.com/info (comment) */ function add($person, $phone) { $new_phone = $person->createDataObject('phone'); foreach ($phone as $prop => $val) { $new_phone[$prop] = $val; } return $person; }
private function get_current_user($sessID) { $sess = new session($sessID); if ($sess->Started()) { $person = new person(); $person->load_current_user($sess->Get("personID")); // update session_started, which affects session lifetime $sess->Save(); return $person; } }
function fix_this_comment($r, $num, $from, $messageid) { global $db; global $alloc_from_addresses2; if ($r["commentEmailUIDORIG"] != $num) { unset($projectID); if ($r["commentMaster"] == "task" && $r["commentMasterID"]) { $q = prepare("select projectID from task where taskID = %d", $r["commentMasterID"]); $db->query($q); $task_row = $db->row(); $projectID = $task_row["projectID"]; } // Try figure out and populate the commentCreatedUser/commentCreatedUserClientContactID fields list($from_address, $from_name) = parse_email_address($from); $person = new person(); $personID = $person->find_by_email($from_address); $personID or $personID = $person->find_by_name($from_name); $sql = array(); $sql[] = prepare("commentEmailUID = '%s'", trim($num)); if ($personID) { $sql[] = prepare("commentCreatedUser = %d", $personID); $sql[] = "commentCreatedUserClientContactID = NULL"; } else { $sql[] = "commentCreatedUser = NULL"; $cc = new clientContact(); $clientContactID = $cc->find_by_email($from_address, $projectID); $clientContactID or $clientContactID = $cc->find_by_name($from_name, $projectID); $clientContactID and $sql[] = prepare("commentCreatedUserClientContactID = %d", $clientContactID); } $sql[] = prepare("commentCreatedUserText = '%s'", trim($from)); $sql[] = prepare("commentEmailMessageID = '%s'", trim($messageid)); if (!in_array($from_address, $alloc_from_addresses2)) { // don't update items that are from alloc $q = prepare("UPDATE comment SET " . implode(",", $sql) . " WHERE commentID = %d", $r["commentID"]); $db->query($q); printorlog("FIXED: " . $q . " (old uid: " . $r["commentEmailUIDORIG"] . ")", "blue"); } } else { // Try figure out and populate the commentCreatedUser/commentCreatedUserClientContactID fields list($from_address, $from_name) = parse_email_address($from); if (!in_array($from_address, $alloc_from_addresses2)) { // don't update items that are from alloc $sql = array(); $sql[] = prepare("commentEmailUID = '%s'", trim($num)); $sql[] = prepare("commentEmailMessageID = '%s'", trim($messageid)); $q = prepare("UPDATE comment SET " . implode(",", $sql) . " WHERE commentID = %d", $r["commentID"]); $db->query($q); printorlog("GOOD: " . $q, "green"); } } }
function show_people($template_name) { global $person_query; global $project; global $TPL; $db = new db_alloc(); $db->query($person_query); while ($db->next_record()) { $person = new person(); $person->read_db_record($db); $person->set_values("person_"); $TPL["graphTitle"] = urlencode($person->get_name()); include_template($template_name); } }
function load_filter($defaults) { $current_user =& singleton("current_user"); // display the list of project name. $db = new db_alloc(); $page_vars = array_keys(timeSheetGraph::get_list_vars()); $_FORM = get_all_form_data($page_vars, $defaults); if ($_FORM["applyFilter"] && is_object($current_user)) { // we have a new filter configuration from the user, and must save it if (!$_FORM["dontSave"]) { $url = $_FORM["url_form_action"]; unset($_FORM["url_form_action"]); $current_user->prefs[$_FORM["form_name"]] = $_FORM; $_FORM["url_form_action"] = $url; } } else { // we haven't been given a filter configuration, so load it from user preferences $_FORM = $current_user->prefs[$_FORM["form_name"]]; } $rtn["personOptions"] = page::select_options(person::get_username_list($_FORM["personID"]), $_FORM["personID"]); $rtn["dateFrom"] = $_FORM["dateFrom"]; $rtn["dateTo"] = $_FORM["dateTo"]; $rtn["personID"] = $_FORM["personID"]; $rtn["groupBy"] = $_FORM["groupBy"]; // GET $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM)); return $rtn; }
/** * Get or create a token for this person_id for this app * @return array */ public function getOAuthToken() { $person_id = $this->person_id(); if (!$person_id) { static::error('User not specified.'); } if (!\person::exists($person_id)) { static::error('Invalid user.'); } $clause = array('person_id' => $person_id); if (!$this->app_key()) { $app_id = null; } else { $api_app = static::getApiAppByKey($this->app_key()); if (!$api_app) { static::error('Invalid app_key.'); } $app_id = $api_app->getID(); } $clause[static::getApiAppModelName() . '_id'] = $app_id; if (!$clause) { static::error('Unknown Identity.'); } $m = static::getOauthModelName(); $oauth = $m::getOne($clause); if (!$oauth || !$oauth->token) { $oauth = $m::insert($clause); } return array('oauth_token' => $oauth->token, 'issued' => $oauth->getTimeIssued(), 'now' => strtotime(\aql::now()), 'expires' => $oauth->getTimeExpires()); }
function show_people() { global $defaults; $_FORM = person::load_form_data($defaults); #echo "<pre>".print_r($_FORM,1)."</pre>"; echo person::get_list($_FORM); }
function set_name($new_name) { //$this->name=strtoupper($new_name); person::set_name($new_name); //static access use double colon sign (::) parent::set_name($new_name); //static access can access class from parent class 1 level }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $person = person::find($id); $person->fill($request->all()); $person->save(); Session::flash('message', 'Persona actualizada Correctamente'); return Redirect::to('people'); }
function postLogin($p) { $success = person::auth($_POST['username'], $_POST['password']); if (!$success) { $this->redirect('login?auth=bad'); } $id = person::getLoggedInId(); $this->redirect("main"); }
function getLoggedInUser() { $id = person::getLoggedInId(); if ($id) { return new Person((int) $id); } else { return NULL; } }
protected function set_name($new_name) { if ($new_name == "Stefan Sucks") { $this->name = $new_name; } else { if ($new_name == "Johnny Fingers") { person::set_name($new_name); } } }
/** * Return Data-Model for the View */ private function getModel() { require_once 'classes/SQL.php'; $model = new stdClass(); $model->template = 'admin/HighscoreTable'; $model->isAdmin = person::getPermissionName() == 'admin' ? 'true' : 'false'; $model->gameID = $this->getGameId(); $sql = new SQL(); $sql->connect(); $model->data = $sql->get("SELECT * FROM ViewHighscore ORDER BY GamerMainScore DESC"); return $model; }
/** * Returns Main-Page from the Admin-Section as HTML-View * @return string */ public function getMain() { include_once 'classes/person.php'; if (person::getPermissionName() != 'admin') { $login = Uri::getAction('Login'); header("Location: {$login}"); } else { require 'classes/view.php'; require './models/admin.php'; $view = new view(); return $view->loadTemplate(new admin_model()); } }
/** * Return Gamer-Main-Page as HTML-View */ public function getMain() { if (person::getPermissionName() != 'admin' && person::getPermissionName() != 'gameuser') { $login = Uri::getAction('Login'); header("Location: {$login}"); } else { require 'classes/view.php'; $model = new stdClass(); $model->template = 'game/main'; $model->hasFrage = isset($_SESSION['tmpFrage']['id']); $model->user = $_SESSION['username']; $model->points = 0; $model->message = $model->hasFrage ? 'Welcome back' : 'Welcome'; $view = new view(); return $view->loadTemplate($model); } }
function add_tsiHint($stuff) { $current_user =& singleton("current_user"); $errstr = "Failed to record new time sheet item hint. "; $username = $stuff["username"]; $people = person::get_people_by_username(); $personID = $people[$username]["personID"]; $personID or alloc_error("Person " . $username . " not found."); $taskID = $stuff["taskID"]; $projectID = $stuff["projectID"]; $duration = $stuff["duration"]; $comment = $stuff["comment"]; $date = $stuff["date"]; if ($taskID) { $task = new task(); $task->set_id($taskID); $task->select(); $projectID = $task->get_value("projectID"); $extra = " for task " . $taskID; } $projectID or alloc_error(sprintf($errstr . "No project found%s.", $extra)); $row_projectPerson = projectPerson::get_projectPerson_row($projectID, $current_user->get_id()); $row_projectPerson or alloc_error($errstr . "The person(" . $current_user->get_id() . ") has not been added to the project(" . $projectID . ")."); if ($row_projectPerson && $projectID) { // Add new time sheet item $tsiHint = new tsiHint(); $d = $date or $d = date("Y-m-d"); $tsiHint->set_value("date", $d); $tsiHint->set_value("duration", $duration); if (is_object($task)) { $tsiHint->set_value("taskID", sprintf("%d", $taskID)); } $tsiHint->set_value("personID", $personID); $tsiHint->set_value("comment", $comment); $tsiHint->save(); $ID = $tsiHint->get_id(); } if ($ID) { return array("status" => "yay", "message" => $ID); } else { alloc_error($errstr . "Time hint not added."); } }
/** * */ protected function person($person) { $person = person::finder()->bypk($person); echo 'This is a (standard) person:' . "\n"; print_r($person); echo "\n"; echo 'This is its favorite movie:' . "\n"; print_r($person->fav_movie_obj); echo "\n"; echo 'The person itself hasn\'t changed:' . "\n"; print_r($person); echo "\n"; echo 'But now I set &cache to true (I can but should never do that inline) and request ' . $person->name . '\'s fav movie again:' . "\n"; $person::$_GETTERS['fav_movie_obj'][1] = true; // This is uncool and you shouldn't do it :) print_r($person->fav_movie_obj); echo "\n"; echo 'And now... ' . $person->name . ' has changed:' . "\n"; print_r($person); }
/** * Checks user-Data for Login and Logg In */ public function loggin() { include_once 'classes/person.php'; $success = false; $uri = ''; if (isset($_POST['username']) && isset($_POST['passwd'])) { $username = (string) htmlspecialchars($_POST['username']); $password = (string) htmlspecialchars($_POST['passwd']); if (person::logIn($username, $password)) { $success = true; switch (person::getPermissionName()) { case 'admin': $uri = Uri::getAction('Admin', 'getMain'); break; case 'gameuser': $uri = Uri::getAction('Gamer', 'getMain'); break; } } } return json_encode(array("success" => $success, "uri" => $uri)); }
</head> <body class="Background_main"> '; if (!$rechte->isBerechtigt('admin', null, 'suid') && !$rechte->isBerechtigt('preinteressent', null, 'suid')) { die('Sie haben keine Berechtigung fuer diese Seite'); } if (isset($_GET['id']) && is_numeric($_GET['id'])) { $id = $_GET['id']; } else { die('<h2>Details</h2>'); } $preinteressent = new preinteressent(); if (!$preinteressent->load($id)) { die('Datensatz konnte nicht geladen werden'); } $person = new person(); if (!$person->load($preinteressent->person_id)) { die('Personen Datensatz konnte nicht geladen werden'); } echo "<h2>Details - {$person->nachname} {$person->vorname}</h2>"; if (isset($_POST['save_preinteressent'])) { //Speichern der Preinteressentdaten $preinteressent->studiensemester_kurzbz = $_POST['studiensemester_kurzbz']; $preinteressent->aufmerksamdurch_kurzbz = $_POST['aufmerksamdurch_kurzbz']; $preinteressent->firma_id = $_POST['firma']; $preinteressent->erfassungsdatum = $datum_obj->formatDatum($_POST['erfassungsdatum'], 'Y-m-d'); $preinteressent->einverstaendnis = isset($_POST['einverstaendnis']); if (isset($_POST['absagedatum']) && $preinteressent->absagedatum == '') { $preinteressent->absagedatum = date('Y-m-d H:i:s'); } if (!isset($_POST['absagedatum'])) {
* * Authors: Christian Paminger <*****@*****.**>, * Andreas Oesterreicher <*****@*****.**> and * Karl Burkhart <*****@*****.**>. */ require_once '../../../config/cis.config.inc.php'; require_once '../../../include/phrasen.class.php'; require_once '../../../include/person.class.php'; if (isset($_GET['lang'])) { setSprache($_GET['lang']); } $sprache = getSprache(); $p = new phrasen($sprache); if (isset($_POST['userid'])) { $login = $_REQUEST['userid']; $person = new person(); session_start(); $preincoming = $person->checkZugangscodeIncoming($login); //Zugangscode wird überprüft if ($preincoming != false) { $_SESSION['incoming/user'] = $login; $_SESSION['incoming/preincomingid'] = $preincoming; header('Location: incoming.php'); exit; } else { $errormsg = $p->t('incoming/ungueltigerbenutzer'); } } ?> <html> <head>
public $salary = 6720.12; public $info = array('a' => 1, 'b' => 2, 'c' => 3); // 方法 function say($sth) { echo $this->name, '说', $sth, '<br/>'; } function study($subject) { echo $this->name, '在学习', $subject, '<br/>'; } function sleep() { echo $this->name, '在睡觉', '<br/>'; } } // 创建对象 $p1 = new person(); $p1->name = '张三'; $p1->study('面向PHP对象'); // print_r($p1); // 创建对象 $p2 = new person(); $p2->name = '李四'; $p2->say('hello world'); // print_r($p2); // 创建对象 $p3 = new person(); $p3->name = '赵五'; $p3->sleep(); // print_r($p3);
function drawperson_xml($row) { global $conn, $datum; $pers = new person(); $pers->load($row->person_id); $stg = new studiengang($row->studiengang_kz); $student_obj = new student(); $student_obj->load_person($row->person_id, $row->studiengang_kz); echo "\n \t\t<person>\n\t\t\t<person_id><![CDATA[" . $pers->person_id . "]]></person_id>\n\t\t\t<anrede><![CDATA[" . $pers->anrede . "]]></anrede>\n\t\t\t<titelpost><![CDATA[" . $pers->titelpost . "]]></titelpost>\n\t\t\t<titelpre><![CDATA[" . $pers->titelpre . "]]></titelpre>\n\t\t\t<nachname><![CDATA[" . $pers->nachname . "]]></nachname>\n\t\t\t<vorname><![CDATA[" . $pers->vorname . "]]></vorname>\n\t\t\t<vornamen><![CDATA[" . $pers->vornamen . "]]></vornamen>\n\t\t\t<name_gesamt><![CDATA[" . trim($pers->anrede . ' ' . $pers->titelpre . ' ' . $pers->vorname . ' ' . $pers->nachname . ' ' . $pers->titelpost) . "]]></name_gesamt>\n\t\t\t<geburtsdatum><![CDATA[" . $datum->convertISODate($pers->gebdatum) . "]]></geburtsdatum>\n\t\t\t<sozialversicherungsnummer><![CDATA[" . $pers->svnr . "]]></sozialversicherungsnummer>\n\t\t\t<ersatzkennzeichen><![CDATA[" . $pers->ersatzkennzeichen . "]]></ersatzkennzeichen>\n\t\t\t<matrikelnr><![CDATA[" . trim($student_obj->matrikelnr) . "]]></matrikelnr>\n\t\t\t<tagesdatum><![CDATA[" . date('d.m.Y') . "]]></tagesdatum>\n\t\t\t<logopath>" . DOC_ROOT . "skin/images/</logopath>\n\t\t\t<studiengang><![CDATA[" . $stg->bezeichnung . "]]></studiengang>\n\t\t</person>"; }
$db->Execute("CREATE TEMPORARY TABLE `children` (\r\n\t `id` int(10) unsigned NOT NULL auto_increment,\r\n\t\t\t\t\t`person_id` int(10) unsigned NOT NULL,\r\n\t `name_first` varchar(100) NOT NULL default '',\r\n\t `name_last` varchar(100) NOT NULL default '',\r\n\t `favorite_pet` varchar(100) NOT NULL default '',\r\n\t PRIMARY KEY (`id`)\r\n\t ) ENGINE=MyISAM;\r\n\t "); $db->Execute("insert into children (person_id,name_first,name_last) values (1,'Jill','Lim')"); $db->Execute("insert into children (person_id,name_first,name_last) values (1,'Joan','Lim')"); $db->Execute("insert into children (person_id,name_first,name_last) values (1,'JAMIE','Lim')"); ADODB_Active_Record::TableHasMany('persons', 'children', 'person_id'); class person extends ADOdb_Active_Record { } $person = new person(); # $person->HasMany('children','person_id'); ## this is affects all other instances of Person $person->name_first = 'John'; $person->name_last = 'Lim'; $person->favorite_color = 'lavender'; $person->save(); // this save will perform an INSERT successfully $person2 = new person(); $person2->Load('id=1'); $c = $person2->children; if (is_array($c) && sizeof($c) == 3 && $c[0]->name_first == 'Jill' && $c[1]->name_first == 'Joan' && $c[2]->name_first == 'JAMIE') { echo "OK Loaded HasMany</br>"; } else { var_dump($c); echo "error loading hasMany should have 3 array elements Jill Joan Jamie<br>"; } class child extends ADOdb_Active_Record { } ADODB_Active_Record::TableBelongsTo('children', 'person', 'person_id', 'id'); $ch = new Child('children', array('id')); $ch->Load('id=1'); if ($ch->name_first !== 'Jill') {
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> OOP PHP </title> <?php include "class_lib.php"; ?> </head> <body> <?php $stefn = new person("stf2"); $jimmy = new person("jimmy"); //$stefn->set_name(); //$jimmy->set_name(); echo "name 1: " . $stefn->get_name(); echo "name 2: " . $jimmy->get_name(); ?> </body> </html>
Username, First_Name, Surname, Password, E-mail, Phone No, Comments */ $cur = config::get_config_item("currency"); $row = 1; if (($handle = fopen("../../David_People.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { foreach ($data as $key => $val) { # $data[$key] = utf8_encode($data[$key]); } $person = new person(); $person->currency = $cur; $person->set_value("username", $data[0]); $person->set_value("firstName", $data[1]); $person->set_value("surname", $data[2]); $person->set_value("password", encrypt_password($data[3])); $person->set_value("emailAddress", $data[4]); $person->set_value("phoneNo1", $data[5]); $person->set_value("comments", $data[6]); $person->set_value("perms", "employee"); $person->set_value("personActive", 1); $person->set_value("personModifiedUser", $current_user->get_id()); $person->save(); $x++; echo "<br>here: " . $person->get_id() . $data[0]; if ($x > 4) {
<?php function test1() { class person { var $name = 'Mickey Mouse'; function get_name() { return $this->name; } } $p = new person(); echo "verifying static variable init and a basic accessor routine<br>\n"; echo "Result: " . ($p->get_name() == 'Mickey Mouse' ? 'pass' : 'fail') . "<br><br>\n\n"; } test1();
if ($dbh_citizen->check_uniqueness($arr_form_data)->is_unique) { //Good, no duplicate in database } else { $message = "Record already exists with the same primary identifiers!"; } if ($message == "" and empty($arr_error)) { $dbh_citizen->add($arr_form_data); $citizen_id = $dbh_citizen->auto_id; require_once 'subclasses/validate.php'; $dbh_citizen = new validate(); for ($a = 0; $a < $validate_count; $a++) { $param = array('proof_of_id' => $cf_validate_proof_of_id[$a], 'proof_of_address' => $cf_validate_proof_of_address[$a], 'citizen_id' => $citizen_id, 'status' => $cf_validate_status[$a]); $dbh_citizen->add($param); } require_once 'subclasses/person.php'; $dbh_person = new person(); $dbh_person->add($arr_form_data); $person_id = $dbh_person->auto_id; $arr_form_data['person_id'] = $person_id; require 'password_crypto.php'; //Hash the password using default Cobalt password hashing technique $hashed_password = cobalt_password_hash('NEW', $password, $username, $new_salt, $new_iteration, $new_method); $arr_form_data['password'] = $hashed_password; $arr_form_data['salt'] = $new_salt; $arr_form_data['iteration'] = $new_iteration; $arr_form_data['method'] = $new_method; $arr_form_data['role_id'] = 3; $arr_form_data['skin_id'] = 1; require_once 'subclasses/user.php'; $dbh_user = new user(); $dbh_user->add($arr_form_data);
echo '<td>' . $row->person_id . '</td>'; echo '<td>' . $row->vorname . '</td>'; echo '<td>' . $row->nachname . '</td>'; echo '<td>'; foreach ($benutzer->result as $row_account) { echo $row_account->uid . ' '; } echo '</td>'; echo '</tr>'; } echo '</tbody></table>'; } } if ($person_id != '') { echo '<br><hr>'; $person = new person(); $person->load($person_id); $fs = new fotostatus(); $fs->getLastFotoStatus($person_id); echo '<table> <tr> <td> <img src="../../content/bild.php?src=person&person_id=' . $person_id . '" height="100px" width="75px"> </td> <td> Vorname: ' . $person->vorname . ' <br>Nachname: ' . $person->nachname . ' <br>Geburtsdatum: ' . $datum_obj->formatDatum($person->gebdatum, 'd.m.Y') . ' </td> </tr> </table>';