function candidateMenu() { // rightscode is 'can001'. // Preparation { $access = testRights($_SESSION["userid"], "can001"); $editrights = "onclick=goTo('index.php?mode=maxine/index&action=pagerights&code=can001')"; // } maxineTop("Candidates System"); // Buttons { openHeader(); maxineButton("Back", "goTo(\"index.php?mode=maxine/index&action=peoplemenu\");", 2); closeHeader(); // } print "<div class='tray'>"; if ($_SESSION["isit"] == 1 || $access > 0) { openSubbar(600); print "Options"; closeSubbar(); print "<table class='standard content1' style='width:600px; margin-bottom:20px;'>"; print "<tr><td align='center'>"; $candidatesaction = "onmouseover='buttonJump(\"candidates\");' onmouseout='buttonStandard(\"candidates\");'"; $candidatesaction .= " onmousedown='buttonPress(\"candidates\");'"; print "<img src='" . BIGBUTTONS . "/candidates.png' id=candidatesbutton onClick=goTo('index.php?mode=maxine/index&action=candidatelist'); " . $candidatesaction . ">"; print "</td>"; print "<td align='center'>"; $reportsaction = "onmouseover='buttonJump(\"reports\");' onmouseout='buttonStandard(\"reports\");'"; $reportsaction .= " onmousedown='buttonPress(\"reports\");'"; print "<img src='" . BIGBUTTONS . "/reports.png' id=reportsbutton onClick=goTo('index.php?mode=maxine/index&action=candidatereports'); " . $reportsaction . ">"; print "</td></tr>"; print "<tr><td align='center'>"; $hardcopyaction = "onmouseover='buttonJump(\"hardcopy\");' onmouseout='buttonStandard(\"hardcopy\");'"; $hardcopyaction .= " onmousedown='buttonPress(\"hardcopy\");'"; print "<img src='" . BIGBUTTONS . "/hardcopy.png' id=hardcopybutton onClick=goTo('index.php?mode=maxine/index&action=candhardcopy'); " . $hardcopyaction . ">"; print "</td>"; print "<td align='center'>"; $statusaction = "onmouseover='buttonJump(\"status\");' onmouseout='buttonStandard(\"status\");'"; $statusaction .= " onmousedown='buttonPress(\"status\");'"; print "<img src='" . BIGBUTTONS . "/status.png' id=statusbutton onClick=goTo('index.php?mode=maxine/index&action=statustypelist'); " . $statusaction . ">"; print "</td></tr>"; print "</table>"; } else { print "You do not have access to this page."; } print "</div>"; maxineBottom(); }
function maxineTop($title = "") { // Prep { ## User Data $mycapsSegments = new TableManager("users"); $mycapsSegments->setWhere($mycapsSegments->quoteString("`users`.`personid`=?", (int) $_SESSION["userid"])); $user = $mycapsSegments->selectSingle(); //$user = sqlPull(array("table"=>"users", "where"=>"personid=".$_SESSION["userid"], "select"=>"firstname, lastname, user_profiles_id", "onerow"=>1)); $smsaccess = testRights($_SESSION["userid"], "sms001"); ## myCAPS segment check if (isset($_SESSION["userid"]) && $_SESSION["userid"]) { $mycapsSegments = new TableManager("mycaps_segments"); $mycapsSegments->setWhere($mycapsSegments->quoteString("`mycaps_segments`.`userid`=?", (int) $_SESSION["userid"]) . $mycapsSegments->quoteString(" AND `mycaps_segments`.`finalized`=?", 0)); $segment = $mycapsSegments->selectSingle(); } ## Profile Data if ($user) { $user_profiles = new TableManager("user_profiles"); ## Test for fortune column $cols = $user_profiles->getColumns(); if (in_array("fortune", $cols) === FALSE) { $sql = (string) "ALTER TABLE `user_profiles` ADD COLUMN `fortune` TINYINT(1) NOT NULL DEFAULT 0, ADD INDEX (`fortune`);"; if ($user_profiles->runSql($sql) === FALSE) { $errors = $user_profiles->getErrors(); echo "<div class=\"error\">mySQL statement encountered an error. Last error was:<br />" . $errors[count($errors) - 1] . "</div>"; return FALSE; } } $user_profiles->setWhere($user_profiles->quoteString("`user_profiles`.`id`=?", $user["user_profiles_id"])); $profile = $user_profiles->selectSingle(); } ## Alerts $manager = new TableManager("alerts"); $manager->setWhere($manager->quoteString("`alerts`.`deleted`=?", (int) 0) . $manager->quoteString(" AND `alerts`.`time_start`<=?", strtotime(date("Y-m-d") . " 00:00")) . $manager->quoteString(" AND `alerts`.`time_end`>=?", strtotime(date("Y-m-d") . " 23:59"))); $manager->setCustomIndex("id"); $alerts = $manager->selectMultiple(); ## Theme $themes = new TableManager("themes"); $themes->setQueryColumns(array("themes" => array("*"))); $themes->setQueryFrom(array("left join" => array(0 => array("table" => array("abbr" => "user_profiles", "table" => "user_profiles"), "on" => "`themes`.`id`=`user_profiles`.`theme_id`"), 1 => array("table" => array("abbr" => "users", "table" => "users"), "on" => "`user_profiles`.`id`=`users`.`user_profiles_id`")))); $where = (string) "(ISNULL(`themes`.`deleted`)"; $where .= $themes->quoteString(" OR `themes`.`deleted`=?)", 0); if ($_SESSION["userid"]) { $where .= $themes->quoteString(" AND `users`.`personid`=?", (int) $_SESSION["userid"]); } else { $where .= $themes->quoteString(" AND `themes`.`id`=?", (int) 1); } $themes->setWhere($where); $theme = $themes->selectSingle(); $backgroundImage = (string) BASE . "images/new/themes/" . $theme["background-image"]; $_SESSION["backgroundRepeat"] = (string) BASE . "images/new/themes/" . $theme["background-repeater"]; $size = getimagesize($backgroundImage); $_SESSION["bgImageSize"] = $size; // } print "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>"; print "<html>"; // Header Info { print "<head>"; print "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />" . PHP_EOL; print "<link href='" . BASE . "/images/favicon.ico' rel='SHORTCUT ICON' />" . PHP_EOL; //print("<link href='".BASE."/basefunctions/scripts/manlinecss.php' rel='stylesheet' type='text/css' />"); print "<link href='" . BASE . "/basefunctions/scripts/manline.css' media='all' rel='stylesheet' type='text/css' />" . PHP_EOL; print "<script type='text/javascript' language='javascript' src='" . BASE . "/basefunctions/scripts/manline.js'></script>"; $headTitle = (string) "Maxweb"; if ($title) { $headTitle .= " - " . $title; } print "<title>" . $headTitle . "</title>" . PHP_EOL; print "</head>"; // } print "<body id=\"windowBody\" style='background-image:url(\"" . $backgroundImage . "\");'>"; //print("<form action='#' method='post'>"); // Header 1 { print "<h1>"; print "<img alt=\"Maxweb Logo\" id=\"maxwebLogo\" src='" . BASE . "/images/new/logo.png' style=\"height:58px;margin-top:2px;width:299px;\">"; print "<span style='float:right; text-align:right;'>"; $links = (array) array("Home" => array("class" => "headerA", "href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=home", "id" => "home"), "Documents" => array("class" => "headerA", "href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=viewdocuments", "id" => "Documents"), "Gallery" => array("class" => "headerA", "href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=viewgallery", "id" => "Gallery"), "InOut" => array("class" => "headerA", "href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=inoutboard", "id" => "InOut"), "Max" => array("class" => "headerA", "href" => "http://login.max.manline.co.za", "id" => "Max", "target" => "_blank"), "Zimbra" => array("class" => "headerA", "href" => "http://mail.manline.co.za", "id" => "Zimbra", "target" => "_blank")); foreach ($links as $text => $data) { echo "<a class=\"" . $data["class"] . "\" href=\"" . $data["href"] . "\" id=\"" . $data["id"] . "\" " . (isset($data["target"]) ? "target=\"" . $data["target"] . "\" " : "") . "title=\"" . $text . "\"></a>" . PHP_EOL; } print "</span>"; print "</h1>"; // } // Header 2 { $messages = (array) array(); if (isset($profile) && $profile) { if (!$profile["staffno"] || !$profile["department_id"] || !$profile["jobtitle"] || !$profile["location"]) { $messages[] = "Your profile information is incomplete."; } } if (isset($segment)) { if (date("U") > (int) $segment["enddate"] + 86400) { $messages[] = "Your CAPS is overdue"; } } if (isset($alerts) && $alerts) { foreach ($alerts as $val) { $messages[] = $val["message"]; } } ## Profile Data if ($messages) { informationBar($messages); } print "<h2>"; print "<span style='width:10px; height:51px; background-image:url(\"" . BASE . "/images/new/menubarleft.png\"); float:left;'></span>"; print "<span style='width:850px; height:36px; background-image:url(\"" . BASE . "/images/new/menubarmid.png\"); float:left; padding-top:15px;'>"; // Left Span - Quick Navigation { print "<span style='float:left; margin-top:-5px;'>"; ## Menu // $items[] = array("href"=>"http://".$_SERVER["SERVER_NAME"]."/Maxine/", "text"=>"", "title"=>""); $items = (array) array(); if ($user) { $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=mycapslist2", "text" => "myCAPS", "title" => "click to go to your CAPs"); } $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=showm3", "text" => "Public M3", "title" => "View public M3 Graphs"); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=dockeeperfront", "text" => "Customer Documents", "title" => "View Documents required by Customers"); if ($user) { $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=m3sys", "text" => "M3", "title" => "View M3 Graphs"); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=displaymydash", "text" => "Personal Dashboard", "title" => "Click to view your personal dashboard"); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=greenmileinput", "text" => "Green Mile Controls", "title" => "Click to update Green Mile Details"); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=ratescalc2", "text" => "Rates Calculator", "title" => "Click to view the rates calculator"); if ($user["isit"] || $user["ismanager"]) { $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=nineblockinput", "text" => "9 Blocker", "title" => "Click to view your 9 Blocker"); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=listalerts", "text" => "Alerts", "title" => "Click to list all alerts"); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=edituserpool", "text" => "User Pools", "title" => "Click to view and edit User Pools"); } $items[] = array("text" => "Faults System", "children" => array(array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=equipfaults", "text" => "Equipment Faults", "title" => "Click to view equipment faults"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=uflist", "text" => "Unit Faults", "title" => "Click to view unit faults"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=faultsys", "text" => "Fault Logging", "title" => "Log a new fault"))); $items[] = array("text" => "Personnel Tools", "children" => array(array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=learnerlist", "text" => "Learner", "title" => "Click to view a list of learners"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=candmenu", "text" => "Candidates", "title" => "Click to view list of candidates"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=driverslist", "text" => "Drivers", "title" => "Click to view list of drivers"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=listusers", "text" => "Users", "title" => "Click to view user list"))); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=updateprofile", "text" => "Edit Your Profile", "title" => "Click to edit your profile"); } /** Cameras link affects 4 = > Jonathan Spencer 5 = > Bradley Roberts 141 = > Jerome Govender 168 = > Lwazi Ally 186 = > Ndumiso Langa */ if (in_array($_SESSION["userid"], array(4, 5, 141, 168, 186))) { $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/cameras/", "text" => "Manline CCTV", "title" => "Click to view the cameras"); } if ($_SESSION["isadmin"] || $smsaccess > 0) { $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=smssystem", "text" => "Send an SMS", "title" => "Click to use the SMS system"); } if ($_SESSION["isit"] == 1) { $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=rightscontrol", "text" => "Access Rights", "title" => "Click to set user access rights"); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=loggingreport", "text" => "Logging Report", "title" => "Click to view the logging report"); if ($_SESSION["isadmin"]) { $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=smssystem", "text" => "Send an SMS", "title" => "Click to use the SMS system"); } $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=sandbox", "text" => "Sandbox", "title" => "Click to go to the coding sandbox"); //$items[] = array("href"=>"http://".$_SERVER["SERVER_NAME"]."/Maxine/index.php?mode=maxine/index&action=encoder", "text"=>"Text Encoder", "title"=>"Click to view the text encoder"); //$items[] = array("href"=>"http://".$_SERVER["SERVER_NAME"]."/Maxine/index.php?mode=maxine/index&action=truckfinder", "text"=>"Truck Finder", "title"=>"Click to view the truck finder"); $items[] = array("text" => "Scaffolding", "children" => array(array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=documents", "text" => "Documents", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=gallery", "text" => "Gallery", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=galleryItems", "text" => "Gallery Items", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=newspaper_articles", "text" => "Newspaper Articles", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=pages", "text" => "Pages", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=themes", "text" => "Themes", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=type", "text" => "Type", "title" => "Click to list all items"), array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?mode=maxine/index&action=list&name=user_profiles", "text" => "User Profiles", "title" => "Click to list all items"))); } /* $items[] = array("text"=>"Corporate Clothing", "children"=>array( array("href"=>"http://".$_SERVER["SERVER_NAME"]."/Maxine/documents/Ladies Clothing Catalogue.pdf", "text"=>"Ladies", "title"=>"Click to download ladies clothing catalogue"), array("href"=>"http://".$_SERVER["SERVER_NAME"]."/Maxine/documents/Mens Clothing Catalogue.pdf", "text"=>"Mens", "title"=>"Click to download mens clothing catalogue") )); */ $items[] = array("href" => "/Maxine/documents/ManlinePriceList.pdf", "text" => "Corporate Clothing", "title" => "Click to download"); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/documents/Map to Head Office.pdf", "text" => "Map to Head office", "title" => "Click to download map to head office"); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=maxexpress", "text" => "Max Express", "title" => "Click to view Max Express editions"); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=viewnews", "text" => "News", "title" => "Click to view newspaper articles"); $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=monthlyvideos", "text" => "Monthly Videos", "title" => "Click to view Neil's monthly video updates"); $sql = (string) "SELECT * FROM `m3_departments`"; $departs = $themes->runSql($sql); $depts = (array) array(); foreach ($departs as $dept) { $depts[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=listdepartment&department=" . urlencode($dept["name"]), "text" => $dept["name"], "title" => "Click to view department members"); } $items[] = array("href" => "http://" . $_SERVER["SERVER_NAME"] . "/Maxine/index.php?action=listdepartment", "text" => "Staff Profiles", "title" => "Click to view all staff members", "children" => $depts); echo menu($items); print "</span>"; // } // Right Span - Login Details { print "<span style='height:34px; float:right; margin-top:-5px; vertical-align:bottom;'>"; if ($_SESSION["userid"] > 0) { print "<p class='standard' style='float:left; margin-right:10px; margin-top:8px;'>Logged in as " . $profile["firstname"] . " " . $profile["lastname"] . "</p>"; echo "<a href=\"/Maxine/?logout\" id=\"logoutbutton\"></a>" . PHP_EOL; } else { $name = ""; if ($_COOKIE["loggedname"]) { $name = $_COOKIE["loggedname"]; } print "<form id=\"loginform\" name='loginform' action='index.php?mode=maxine/index&action=loginaction' method='post'>"; print "<span style='width:16px; height:19px; background-image:url(\"" . BASE . "/images/new/loginicon.png\"); float:left; margin-top:5px;'></span>"; print "<span style='width:10px; height:25px; background-image:url(\"" . BASE . "/images/new/loginleft.png\"); float:left; margin-left:10px; margin-top:4px; '></span>"; print "<input id=\"username\" name='conf[username]' value='" . $name . "' class='loginmid' onKeyPress='submitenter(this,event);' />"; print "<span style='width:10px; height:25px; background-image:url(\"" . BASE . "/images/new/loginright.png\"); float:left; margin-top:4px; '></span>"; print "<span style='width:10px; height:25px; background-image:url(\"" . BASE . "/images/new/loginleft.png\"); float:left; margin-left:10px; margin-top:4px;'></span>"; print "<input type='password' id='passbox' name='conf[password]' class='loginmid' onKeyPress='submitenter(this,event);' />"; print "<span style='width:10px; height:25px; background-image:url(\"" . BASE . "/images/new/loginright.png\"); float:left; margin-top:4px; '></span>"; echo "<a href=\"#\" id=\"loginbutton\" onclick=\"document.getElementById('loginform').submit();\"></a>" . PHP_EOL; print "</form>"; } print "</span>"; // } print $title; print "</span>"; print "<span style='width:10px; height:51px; background-image:url(\"" . BASE . "/images/new/menubarright.png\"); float:left;'></span>"; print "</h2>"; if (isset($_SESSION["userid"]) && in_array($_SESSION["userid"], array(4, 23, 175)) || isset($profile["fortune"]) && $profile["fortune"]) { $fortune = shell_exec("fortune -s -n 100"); echo "<div style=\"height:24px;margin:-14px auto 15px;position:relative;width:850px;\">"; echo "<img alt=\"left corner\" src=\"" . BASE . "images/new/cookiebar_left.png\" style=\"height:24px;left:0px;position:absolute;top:0px;width:10px;\" />"; echo "<div style=\"background-image:url(" . BASE . "images/new/cookiebar_mid.png);font-size:0.8em;height:24px;margin:-3px auto 0px;vertical-align:top;width:830px;\">" . $fortune . "</div>"; echo "<img alt=\"right corner\" src=\"" . BASE . "images/new/cookiebar_right.png\" style=\"height:24px;position:absolute;right:0px;top:0px;width:10px;\" />"; echo "</div>"; } // } }
function learnerList() { $learners = new Learners(); // Preparation { $editrights = ""; $access = testRights($_SESSION["userid"], "lea001"); if ($_SESSION["isit"] == 1) { $access = 10; $editrights = "onclick=goTo('index.php?mode=maxine/index&action=pagerights&code=lea001')"; } $conf = $_POST["conf"]; if (!$conf["searchtype"]) { $conf["searchtype"] = 1; } // Where { $learnerwhere = "l.deleted = 0"; // Learner Details Search { if ($conf["search"]["firstname"]) { $learnerwhere .= " AND l.firstname LIKE '%" . $conf["search"]["firstname"] . "%'"; } if ($conf["search"]["lastname"]) { $learnerwhere .= " AND l.lastname LIKE '%" . $conf["search"]["lastname"] . "%'"; } if ($conf["search"]["idno"]) { $learnerwhere .= " AND idno LIKE '%" . $conf["search"]["idno"] . "%'"; } if ($conf["search"]["contactno"]) { $learnerwhere .= " AND contactno LIKE '%" . $conf["search"]["contactno"] . "%'"; } if ($conf["search"]["statusid"] > 0) { $learnerwhere .= " AND statusid = " . $conf["search"]["statusid"]; } // } // Note Search { if ($conf["notesearch"]) { $notewhere = "note LIKE '%" . $conf["notesearch"] . "%' AND learnerid > 0"; $notelist = sqlPull(array("table" => "candidate_notes", "where" => $notewhere, "group" => "learnerid")); if ($notelist) { $learnerwhere .= " AND id in (0"; foreach ($notelist as $notekey => $noteval) { $learnerwhere .= "," . $noteval["learnerid"]; } $learnerwhere .= ")"; } else { $learnerwhere = "0 = 1"; // Deliberately set the learner search to fail, as no notes match search. } } // } // } // Sort { if ($conf["sortvar"] == 1 || $conf["sortvar"] == 2) { $sort = "firstname"; } else { if ($conf["sortvar"] == 3 || $conf["sortvar"] == 4) { $sort = "lastname"; } else { if ($conf["sortvar"] == 5 || $conf["sortvar"] == 6) { $sort = "idno"; } else { if ($conf["sortvar"] == 7 || $conf["sortvar"] == 8) { $sort = "contactno"; } else { if ($conf["sortvar"] == 9 || $conf["sortvar"] == 10) { $sort = "statusid"; } else { $sort = "firstname"; } } } } } if ($conf["sortvar"]) { if (fmod($conf["sortvar"], 2) == 1) { $sort .= " ASC"; } else { $sort .= " DESC"; } } else { $sort .= " ASC"; } // } $learnerlist = $learners->getRowSet(array("where" => $learnerwhere, "sort" => $sort, 'children' => true)); $statuslist = array(1 => "", 2 => "Failed", 3 => "Passed"); // } maxineTop("Learner List"); print "<form id='listform' name='listform' action='index.php?mode=maxine/index&action=learnerlist' method=post>"; // Buttons { openHeader(); if ($access > 0) { maxineButton("Add", "goTo(\"index.php?mode=maxine/index&action=editlearner\");", 2); maxineButton("Search", "toggle(\"searchdiv\");", 2); } maxineButton("Back", "goTo(\"index.php?mode=maxine/index&action=peoplemenu\");", 2); closeHeader(); // } print "<div class='tray'>"; // Search Box { print "<div id='searchdiv' style='display: none;'>"; openSubbar(400); print "Search Box"; closeSubbar(); print "<table class='standard' style='width:400px;'>"; // Standard search { print "<tr class='content1'><td align='center' width=40%>"; print "First Name"; print "</td><td width=60%>"; print "<input name=conf[search][firstname] value='" . $conf["search"]["firstname"] . "' style='width:200px;'>"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Last Name"; print "</td><td>"; print "<input name=conf[search][lastname] value='" . $conf["search"]["lastname"] . "' style='width:200px;'>"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "ID Number"; print "</td><td>"; print "<input name=conf[search][idno] value='" . $conf["search"]["idno"] . "' style='width:200px;'>"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Contact Number"; print "</td><td>"; print "<input name=conf[search][contactno] value='" . $conf["search"]["contactno"] . "' style='width:200px;'>"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Status"; print "</td><td>"; print "<select name=conf[search][statusid] style='width:200px; color:BLACK;'>"; print "<option value=0 " . ($conf["search"]["statusid"] == 0 ? "selected" : "") . ">- Select -</option>"; print "<option value=1 " . ($conf["search"]["statusid"] == 1 ? "selected" : "") . ">No Status</option>"; print "<option value=2 " . ($conf["search"]["statusid"] == 2 ? "selected" : "") . ">Failed</option>"; print "<option value=3 " . ($conf["search"]["statusid"] == 3 ? "selected" : "") . ">Passed</option>"; print "</select>"; print "</td></tr>"; // } // Note search { print "<tr class='content1'><td align='center' width=40%>"; print "Note Text"; print "</td><td width=60%>"; print "<input name=conf[notesearch] value='" . $conf["notesearch"] . "' style='width:200px;'>"; print "</td></tr>"; // } print "<tr class='content1'><td align='center' colspan=2>"; maxineButton("Submit", "listform.submit();", 0); print "</td></tr>"; print "</table>"; print "</div"; // } // Results { if ($access > 0) { if ($conf["search"]["firstname"] == "Mickey" && $conf["search"]["lastname"] == "Mouse") { print "<img src='" . BASE . "/images/mickey.png'>"; } else { openSubbar(800); print "<span " . $editrights . ">Details</span>"; closeSubbar(); print "<table class='standard' style='width:800px; margin-bottom:20px;'>"; if ($learnerlist) { // Headers { print "<input type='hidden' id=sorttype name=conf[sortvar] value=" . $conf["sortvar"] . ">"; print "<tr class='heading'><td align='center' width=5%>"; print "</td><td align='center' onClick='sorttype.value=" . ($conf["sortvar"] == 1 ? "2" : "1") . "; listform.submit();' width=40%>"; print "Learner Name"; if ($conf["sortvar"] == 1) { print "<img src='" . BASE . "/images/downarrow.png'>"; } else { if ($conf["sortvar"] == 2) { print "<img src='" . BASE . "/images/uparrow.png'>"; } } print "<img src='" . BASE . "/images/miniclickable.png' onClick='sorttype.value=" . ($conf["sortvar"] == 3 ? "4" : "3") . "; listform.submit();'>"; if ($conf["sortvar"] == 3) { print "<img src='" . BASE . "/images/downarrow.png'>"; } else { if ($conf["sortvar"] == 4) { print "<img src='" . BASE . "/images/uparrow.png'>"; } } print "</td><td align='center' onClick='sorttype.value=" . ($conf["sortvar"] == 5 ? "6" : "5") . "; listform.submit();' width=20%>"; print "ID Number"; if ($conf["sortvar"] == 5) { print "<img src='" . BASE . "/images/downarrow.png'>"; } else { if ($conf["sortvar"] == 6) { print "<img src='" . BASE . "/images/uparrow.png'>"; } } print "</td><td align='center' onClick='sorttype.value=" . ($conf["sortvar"] == 7 ? "8" : "7") . "; listform.submit();' width=20%>"; print "Contact Number"; if ($conf["sortvar"] == 7) { print "<img src='" . BASE . "/images/downarrow.png'>"; } else { if ($conf["sortvar"] == 8) { print "<img src='" . BASE . "/images/uparrow.png'>"; } } print "</td><td align='center' onClick='sorttype.value=" . ($conf["sortvar"] == 9 ? "10" : "9") . "; listform.submit();' width=15%>"; print "Status"; if ($conf["sortvar"] == 9) { print "<img src='" . BASE . "/images/downarrow.png'>"; } else { if ($conf["sortvar"] == 10) { print "<img src='" . BASE . "/images/uparrow.png'>"; } } print "</td></tr>"; // } foreach ($learnerlist as $learnerkey => $learnerval) { // Note Title Creation { $notelist = $learnerval['candidate_notes']; $notesummary = ""; $innertext = ""; $popup = ""; if ($notelist) { $innertext = "<table>"; $innertext .= "<tr><td align=\"center\">"; $innertext .= "Notes"; $innertext .= "</td></tr>"; $notecount = 1; foreach ($notelist as $notekey => $note) { $innertext .= "<tr><td>"; $textnote = str_replace("'", "", $note["note"]); $innertext .= $notecount . " : " . $textnote; $innertext .= "</td></tr>"; $notecount++; } $innertext .= "</table>"; } else { $innertext = "<table>"; $innertext .= "<tr><td align=\"center\">"; $innertext .= "No notes"; $innertext .= "</td></tr>"; $innertext .= "</table>"; } $popup = "cavtitle='" . $innertext . "' onmousemove='setCavTimer(event);' onmouseout='CancelCavTimer(event);'"; // } print "<tr class='content1' style=\"cursor:pointer;\" onClick=\"goTo('index.php?mode=maxine/index&action=&action=editlearner&learnerid=" . $learnerval["id"] . "');\"><td align='center'>\n"; print "<img src='" . BASE . "/images/note.png' " . $popup . ">"; print "</td><td align='center'>"; if ($conf["sortvar"] == 3 || $conf["sortvar"] == 4) { print $learnerval["lastname"] . ", " . $learnerval["firstname"] . " " . $learnerval["middlename"]; } else { print $learnerval["firstname"] . " " . $learnerval["middlename"] . " " . $learnerval["lastname"]; } print "</td><td align='center'>"; print $learnerval["idno"]; print "</td><td align='center'>"; print $learnerval["contactno"]; print "</td><td align='center'>"; print $statuslist[$learnerval["statusid"]]; print "</td></tr>"; } } else { print "<tr><td align='center' colspan=2>"; print "No Learners match search"; print "</td></tr>"; } print "</table>"; } } else { print "You do not have access to this page."; } // } print "</div>"; print "</form>"; maxineBottom(); }
function listUsers() { // rightscode is 'usr001'. $users = new Users(); // Preparation { $access = testRights($_SESSION["userid"], "usr001"); $editrights = "onclick=goTo('index.php?mode=maxine/index&action=pagerights&code=usr001')"; if ($_POST["conf"]) { $conf = $_POST["conf"]; } // Building the Where string { $where = "1=1"; if ($conf["search"]["firstname"]) { $where .= " AND firstname LIKE '%" . $conf["search"]["firstname"] . "%'"; } if ($conf["search"]["lastname"]) { $where .= " AND lastname LIKE '%" . $conf["search"]["lastname"] . "%'"; } if ($conf["search"]["dept"] > 0) { $where .= " AND deptid=" . $conf["search"]["dept"]; } // } // Building the Sort string { if ($conf["sortvar"]) { $sort = $conf["sortvar"]; } else { $sort = "1"; } if ($sort == 1) { $sortstr = "up.firstname ASC, up.lastname ASC"; } else { if ($sort == 2) { $sortstr = "up.firstname DESC, up.lastname DESC"; } else { if ($sort == 5) { $sortstr = "position ASC"; } else { if ($sort == 6) { $sortstr = "position DESC"; } else { if ($sort == 7) { $sortstr = "deptid DESC"; } else { if ($sort == 8) { $sortstr = "deptid ASC"; } } } } } } // } //$userlist = sqlPull(array("table"=>"users", "where"=>"isgeneric=0", "sort"=>$sortstr)); $userlist = $users->getRowSet(array("sort" => $sortstr, "where" => $where . " and u.deleted=0 and u.personid!=1", "children" => true)); $deptlist = sqlPull(array("table" => "m3_departments", "where" => "1=1")); $reload = "userlistform.action=\"index.php?mode=maxine/index&action=listusers\"; userlistform.submit()'"; $mouseover = "onmouseover=\"this.style.backgroundImage='url(../../images/new/mainblack.png)';\" onmouseout=\"this.style.backgroundImage='';\""; // } maxineTop("Users"); print "<form name='userlistform' id='userlistform' action='index.php?mode=maxine/index&action=edituser' method='post'>"; // Buttons { openHeader(); if ($_SESSION["isit"] == 1 || $access > 0) { maxineButton("Add User", "goTo(\"index.php?mode=maxine/index&action=edituser\");", 2); maxineButton("Search", "toggle(\"searchdiv\");", 2); } maxineButton("Back", "goTo(\"index.php?mode=maxine/index&action=peoplemenu\");", 2); closeHeader(); // } print "<div class='tray'>"; // Search { print "<div id='searchdiv' style='display:none'>"; openSubbar(400); print "Search Box"; closeSubbar(); print "<table class='standard' style='width:400px;'>"; print "<tr class='content1'><td align='center' width=40%>"; print "First Name"; print "</td><td width=60% align='left'>"; print "<input name=conf[search][firstname] value='" . $conf["search"]["firstname"] . "' style='width:200px'>"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Last Name"; print "</td><td align='left'>"; print "<input name=conf[search][lastname] value='" . $conf["search"]["lastname"] . "' style='width:200px;'"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Department"; print "</td><td>"; print "<select name='conf[search][dept]' id='deptselect' style='z-index:500; width:180px; color:BLACK;'>"; print "<option value=0>- Select Department -</option>"; foreach ($deptlist as $deptkey => $deptval) { print "<option value=" . $deptval["id"] . " " . ($conf["search"]["dept"] == $deptval["id"] ? "selected" : "") . ">" . $deptval["name"] . "</option>"; } print "</select>"; print "</td></tr>"; print "<tr class='content1'><td align='center' colspan=2>"; maxineButton("Submit", $reload, 2); print "</td></tr>"; print "</table>"; print "</div>"; // } if ($_SESSION["isit"] == 1 || $access > 0) { if ($userlist) { // Hidden data controls { print "<input type='hidden' id='sorttype' name='conf[sortvar]' value=" . $conf["sortvar"] . ">"; print "<input type=hidden id='useridinput' name='conf[personid]'>"; // This variable is set to the selected users id, and then submitted with the form. // } openSubbar(800); print "<span " . $editrights . ">User List</span>"; closeSubbar(); print "<table class='standard' style='width:800px; margin-bottom:25px;'>"; // Headers { print "<tr class='heading'>"; print "<td align='center' width=45% onClick='sorttype.value=" . ($sort == 1 ? "2" : "1") . "; " . $reload . ">"; print "Name"; if ($sort == 1) { print "<img src='" . BASE . "/images/downarrow.png'>"; } else { if ($sort == 2) { print "<img src='" . BASE . "/images/uparrow.png'>"; } } print "</td>"; print "<td align='center' width=30% onClick='sorttype.value=" . ($sort == 5 ? "6" : "5") . "; " . $reload . ">"; print "Position"; if ($sort == 5) { print "<img src='" . BASE . "/images/downarrow.png'>"; } else { if ($sort == 6) { print "<img src='" . BASE . "/images/uparrow.png'>"; } } print "</td>"; print "<td align='center' width=25% onClick='sorttype.value=" . ($sort == 7 ? "8" : "7") . "; " . $reload . ">"; print "Department"; if ($sort == 7) { print "<img src='" . BASE . "/images/downarrow.png'>"; } else { if ($sort == 8) { print "<img src='" . BASE . "/images/uparrow.png'>"; } } print "</td></tr>"; // } $count = 1; foreach ($userlist as $userkey => $userval) { $bday = date("d", $userval['userdates']['birthday']['date']); $bmonth = date("m", $userval['userdates']['birthday']['date']); print "<tr class='content1' style='cursor:pointer' onclick='openUser(" . $userval["personid"] . ");' " . $mouseover . "><td align='center'>"; if ($userval["isgeneric"] < 1 && $userval["isplace"] < 1) { print $userval["firstname"] . " " . $userval["lastname"] . " (" . $userval["username"] . ")"; } else { print $userval["username"]; } if ($bday == 01 && $bmonth == 01 && $userval["isgeneric"] < 1 && $userval["isplace"] < 1) { print "<img src='" . BASE . "/images/redcross.png'>"; } print "</td><td align='center'>"; print $userval["position"]; print "</td><td align='center'>"; if ($userval["deptid"] == 0 && $userval["isgeneric"] < 1 && $userval["isplace"] < 1) { print "No Department"; } else { print $userval['department']; } print "</td></tr>"; $count++; } print "</table>"; } else { print "<tr><td align='center'>"; print "No Users meet search."; print "</td></tr>"; } } else { print "<tr><td align='center'>"; print "You do not have access to this page."; } print "</div>"; closeTrayDiv(); print "</form>"; maxineBottom(); //$onclick = "personid.value=".$userval["personid"]."; userlistform.submit();"; // Javascript { print "<script>\n\t\t\t\t\tfunction openUser(userid) {\n\t\t\t\t\t\tdocument.getElementById('useridinput').value\t= userid;\n\t\t\t\t\t\tdocument.getElementById('userlistform').submit();\n\t\t\t\t\t}\n\t\t\t\t\t</script>"; // } }
function listUsers() { // rightscode is 'usr001'. // Preparation { $access = testRights($_SESSION["userid"], "usr001"); $editrights = "onclick=goTo('/Maxine/?pagerights&code=usr001')"; if ($_POST["conf"]) { $conf = $_POST["conf"]; } //$userlist = sqlPull(array("table"=>"users", "where"=>"isgeneric=0", "sort"=>$sortstr)); $users = new TableManager("users"); $users->setQueryFrom(array("left join" => array(0 => array("table" => array("abbr" => "user_profiles", "table" => "user_profiles"), "on" => "`user_profiles`.`id`=`users`.`user_profiles_id`")))); $users->setQueryColumns(array("users" => array("personid", "user_profiles_id", "username", "email", "extension", "cell", "isplace", "isgeneric", "deleted"), "user_profiles" => array("firstname", "lastname", "jobtitle", "staffno", "id", "birthday", "department_id", "location", "interests", "family", "aspirations", "goals", "quote", "createDate"))); // Building the Where string { $where = "`users`.`deleted`=0 AND personid!=1"; if ($conf["search"]["firstname"]) { $where .= $users->quoteString(" AND `user_profiles`.`firstname` like ?", "%" . $conf["search"]["firstname"] . "%"); } if ($conf["search"]["lastname"]) { $where .= $users->quoteString(" AND `user_profiles`.`lastname` like ?", "%" . $conf["search"]["lastname"] . "%"); } if ($conf["search"]["position"]) { $where .= $users->quoteString(" AND `user_profiles`.`jobtitle` like ?", "%" . $conf["search"]["position"] . "%"); } if ($conf["search"]["department"]) { $where .= $users->quoteString(" AND `user_profiles`.`department_id`=?", $conf["search"]["department"]); } // } $users->setWhere($where); // Building the Sort string { if ($conf["sortvar"]) { $sort = $conf["sortvar"]; } else { $sort = "1"; } if ($sort == 1) { $users->setOrderBy(array("column" => "firstname", "direction" => "ASC")); } else { if ($sort == 2) { $users->setOrderBy(array("column" => "firstname", "direction" => "DESC")); } else { if ($sort == 5) { $users->setOrderBy(array("column" => "jobtitle", "direction" => "ASC")); } else { if ($sort == 6) { $users->setOrderBy(array("column" => "jobtitle", "direction" => "DESC")); } else { if ($sort == 7) { $users->setOrderBy(array("column" => "department_id", "direction" => "DESC")); } else { if ($sort == 8) { $users->setOrderBy(array("column" => "department_id", "direction" => "ASC")); } } } } } } // } $userlist = $users->selectMultiple(); $deptlist = sqlPull(array("table" => "m3_departments", "where" => "1=1")); $reload = "userlistform.action=\"/Maxine/?listusers\"; userlistform.submit()'"; $mouseover = "onmouseover=\"this.style.backgroundImage='url(../../images/new/mainblack.png)';this.style.color='WHITE';\" onmouseout=\"this.style.backgroundImage='';this.style.color='BLACK';\""; // } maxineTop("Users"); print "<form name='userlistform' id='userlistform' action='/Maxine/?edituser' method='post'>"; // Buttons { openHeader(); if ($_SESSION["isit"] == 1 || $access > 0) { maxineButton("Add User", "goTo(\"/Maxine/?edituser\");", 2); maxineButton("Search", "toggle(\"searchdiv\");", 2); } maxineButton("Back", "history.go(-1);", 2); closeHeader(); // } print "<div class='tray'>"; // Search { print "<div id='searchdiv' style='display:none'>"; openSubbar(400); print "Search Box"; closeSubbar(); print "<table class='standard' style='width:400px;'>"; print "<tr class='content1'><td align='center' width=40%>"; print "First Name"; print "</td><td width=60% align='left'>"; print "<input name=conf[search][firstname] value='" . $conf["search"]["firstname"] . "' style='width:200px'>"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Last Name"; print "</td><td align='left'>"; print "<input name=conf[search][lastname] value='" . $conf["search"]["lastname"] . "' style='width:200px;'"; print "</td></tr>"; print "<tr class='content1'><td align='center'>"; print "Department"; print "</td><td>"; print "<select name='conf[search][dept]' id='deptselect' style='z-index:500; width:180px; color:BLACK;'>"; print "<option value=0>- Select Department -</option>"; foreach ($deptlist as $deptkey => $deptval) { print "<option value=" . $deptval["id"] . " " . ($conf["search"]["dept"] == $deptval["id"] ? "selected" : "") . ">" . $deptval["name"] . "</option>"; } print "</select>"; print "</td></tr>"; print "<tr class='content1'><td align='center' colspan=2>"; maxineButton("Submit", $reload, 2); print "</td></tr>"; print "</table>"; print "</div>"; // } if ($_SESSION["isit"] == 1 || $access > 0) { if ($userlist) { // Hidden data controls { print "<input type='hidden' id='sorttype' name='conf[sortvar]' value=" . $conf["sortvar"] . ">"; print "<input type=hidden id='useridinput' name='conf[personid]'>"; // This variable is set to the selected users id, and then submitted with the form. // } openSubbar(800); print "<span " . $editrights . ">User List</span>"; closeSubbar(); print "<table class='standard' style='width:800px; margin-bottom:25px;'>"; // Headers { print "<tr class='heading'>"; print "<td align='center' width=45% onClick='sorttype.value=" . ($sort == 1 ? "2" : "1") . "; " . $reload . ">"; print "Name"; if ($sort == 1) { print "<img src='" . BASE . "/images/downarrow.png'>"; } else { if ($sort == 2) { print "<img src='" . BASE . "/images/uparrow.png'>"; } } print "</td>"; print "<td align='center' width=30% onClick='sorttype.value=" . ($sort == 5 ? "6" : "5") . "; " . $reload . ">"; print "Position"; if ($sort == 5) { print "<img src='" . BASE . "/images/downarrow.png'>"; } else { if ($sort == 6) { print "<img src='" . BASE . "/images/uparrow.png'>"; } } print "</td>"; print "<td align='center' width=25% onClick='sorttype.value=" . ($sort == 7 ? "8" : "7") . "; " . $reload . ">"; print "Department"; if ($sort == 7) { print "<img src='" . BASE . "/images/downarrow.png'>"; } else { if ($sort == 8) { print "<img src='" . BASE . "/images/uparrow.png'>"; } } print "</td></tr>"; // } $count = 1; foreach ($userlist as $userkey => $userval) { $bday = date("d", $userval['userdates']['birthday']['date']); $bmonth = date("m", $userval['userdates']['birthday']['date']); print "<tr class='content1' style='cursor:pointer' onclick='openUser(" . $userval["personid"] . ");' " . $mouseover . "><td align='center'>"; if ($userval["isgeneric"] < 1 && $userval["isplace"] < 1) { print $userval["firstname"] . " " . $userval["lastname"] . " (" . $userval["username"] . ")"; } else { print $userval["username"]; } if ($userval["user_profiles_id"] == 0 && $userval["isgeneric"] < 1 && $userval["isplace"] < 1) { print "<img src='" . BASE . "/images/redcross.png' title='No Profile'>"; } print "</td><td align='center'>"; print $userval["jobtitle"]; print "</td><td align='center'>"; if ($userval["department_id"] == 0 && $userval["isgeneric"] < 1 && $userval["isplace"] < 1) { print "No Department"; } else { print $deptlist[$userval["department_id"]]["name"]; } print "</td></tr>"; $count++; } print "</table>"; } else { print "<tr><td align='center'>"; print "No Users meet search."; print "</td></tr>"; } } else { print "<tr><td align='center'>"; print "You do not have access to this page."; } print "</div>"; closeTrayDiv(); print "</form>"; maxineBottom(); //$onclick = "personid.value=".$userval["personid"]."; userlistform.submit();"; // Javascript { print "<script>\n\t\t\t\t\tfunction openUser(userid) {\n\t\t\t\t\t\tdocument.getElementById('useridinput').value\t= userid;\n\t\t\t\t\t\tdocument.getElementById('userlistform').submit();\n\t\t\t\t\t}\n\t\t\t\t\t</script>"; // } }