/** returnFleetTruckCount()
 * get all fleets truck count
 * @return array on success false otherwise
 */
function returnFleetTruckCount()
{
    require_once BASE . "/basefunctions/baseapis/TableManager.php";
    $manager = new TableManager("fleet_truck_count");
    $manager->setCustomIndex("fleet_id");
    return $manager->selectMultiple();
}
 /** Scaffold_Forms_GalleryItems::setHtml($html = null)
  * @param string $html HTML form definition
  */
 public function setHtml($html = null)
 {
     if ($html === null) {
         $record = self::getRecord();
         if (is_object("TableManager") === false) {
             include_once BASE . DIRECTORY_SEPARATOR . "basefunctions" . DIRECTORY_SEPARATOR . "baseapis" . DIRECTORY_SEPARATOR . "TableManager.php";
         }
         $tableManager = new TableManager("gallery");
         $tableManager->setWhere("ISNULL(`deleted`)");
         $gallery = $tableManager->selectMultiple();
         $html = (string) "<script type=\"text/javascript\" src=\"" . BASE . DIRECTORY_SEPARATOR . "basefunctions" . DIRECTORY_SEPARATOR . "scripts" . DIRECTORY_SEPARATOR . "ajax_file_upload.js\"></script>" . PHP_EOL;
         $html .= "<script type=\"text/javascript\" src=\"" . BASE . DIRECTORY_SEPARATOR . "basefunctions" . DIRECTORY_SEPARATOR . "scripts" . DIRECTORY_SEPARATOR . "ajax_directory_list.js\"></script>" . PHP_EOL;
         $html .= "<noscript><p class=\"error\">I'm sorry but you need to enable javascript for this to work correctly.</p></noscript>" . PHP_EOL;
         $html .= "<form method=\"POST\" id=\"uploaderForm\" style=\"width:750px;\">" . PHP_EOL;
         $html .= "<div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "<label for=\"gallery_id\" style=\"color:#000;\">Gallery</label>" . PHP_EOL;
         $html .= "<select id=\"gallery_id\" name=\"gallery_id\">" . PHP_EOL;
         $html .= "<option value=\"0\">Please select...</options>" . PHP_EOL;
         foreach ($gallery as $gall) {
             $html .= "<option value=\"" . $gall["id"] . "\"" . ($record && $record["gallery_id"] == $gall["id"] ? " selected=\"selected\"" : "") . ">" . $gall["name"] . "</option>" . PHP_EOL;
         }
         $html .= "</select><br class=\"clear\" />" . PHP_EOL;
         $html .= "<fieldset id=\"appendHere\">" . PHP_EOL;
         $html .= "<legend>Items</legend>" . PHP_EOL;
         ## upload a single file to the gallery
         $html .= "<div style=\"float:left;width:350px;\">" . PHP_EOL;
         $html .= "<label for=\"is_landscape\" style=\"color:#000;\">Is Landscape?</label>" . PHP_EOL;
         $html .= "<input" . ($record["is_landscape"] ? " checked=\"checked\"" : "") . " id=\"is_landscape\" name=\"is_landscape\" type=\"checkbox\" value=\"1\" />";
         $html .= "<label for=\"name[0]\" style=\"color:#000;\">Name</label>" . PHP_EOL;
         $html .= "<input type=\"text\" class=\"standard\" id=\"name[0]\" name=\"name[0]\" readonly=\"readonly\" value=\"" . ($record ? $record["name"] : "") . "\" /><br />" . PHP_EOL;
         $html .= "<label for=\"location_file[0]\" style=\"color:#000;\">Location</label>" . PHP_EOL;
         $location = (string) "gallery/";
         $html .= "<input type=\"file\" id=\"location_file[0]\" name=\"location_file[0]\" readonly=\"readonly\" onchange=\"document.getElementById('name[0]').value = this.value.toString().substring(0, this.value.toString().lastIndexOf('.'));\" />" . PHP_EOL;
         $html .= "<input type=\"hidden\" name=\"file[0]\" id=\"file[0]\" />" . PHP_EOL;
         $html .= "<button onclick=\"ajaxFileUpload.doUpload('" . $location . "', 'file[0]', 'location_file[0]'); return false;\">Upload</button>" . PHP_EOL;
         $html .= "<br />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         ## Use a directory path
         $html .= "<div style=\"border-left:1px solid #DCDCDC;float:left;padding-left:10px;text-align:left;width:350px;\">" . PHP_EOL;
         $html .= "<label for=\"file_path\" style=\"color:#000;\" title=\"Examples: http://www.facebook.com/images/, /var/www/pookybear etc....\">Location</label>" . PHP_EOL;
         $html .= "<input type=\"text\" id=\"file_path\" name=\"file_path\" />&nbsp;";
         $html .= "<button onclick=\"directory.doScan(document.getElementById('file_path').value, 'fileListing'); return false;\">Find Files...</button><br />" . PHP_EOL;
         $html .= "<label for=\"checkAll\" style=\"color:#000;\">Check All</label>";
         $html .= "<input type=\"checkbox\" id=\"checkAll\" name=\"checkAll\" disabled=\"disabled\" onclick=\"directory.handleFormInputs('uploaderForm', this);\" />";
         $html .= "<br />" . PHP_EOL;
         $html .= "<div id=\"fileListing\"></div>" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "</fieldset>" . PHP_EOL;
         $html .= "<div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "</form>" . PHP_EOL;
         //$html .= "<iframe id=\"targetFrame\" name=\"targetFrame\"></iframe>".PHP_EOL;
         $html .= "<iframe id=\"targetFrame\" name=\"targetFrame\" style=\"display:none;\"></iframe>" . PHP_EOL;
         $html .= "<p id=\"upload_process\" style=\"display:none;\"><img src=\"" . BASE . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . "new" . DIRECTORY_SEPARATOR . "loading.png\" alt=\"Loading\" title=\"Please be patient. Uploading your file can take a bit of time\" /></p>" . PHP_EOL;
     }
     $this->_html = $html;
 }
 /** fleetTruckLinkImporter::__construct()
  * Class constructor
  */
 public function __construct()
 {
     $realPath = realpath(dirname(__FILE__));
     $maxine = substr($realPath, 0, strrpos($realPath, DIRECTORY_SEPARATOR));
     $rootaccess = substr($maxine, 0, strrpos($maxine, DIRECTORY_SEPARATOR) + 1);
     define("BASE", $rootaccess);
     include_once BASE . "basefunctions/baseapis/TableManager.php";
     include_once BASE . "basefunctions/baseapis/FileParser/FileParser.php";
     $manager = new TableManager("fleet_truck_count");
     $apiurl = "https://t24.max.bwtsgroup.com/api_request/Report/export?report=73&responseFormat=csv";
     // Live
     // $apiurl	= "http://max.mobilize.biz/m4/2/api_request/Report/export?report=141&responseFormat=csv"; // Test
     $required_fleets = (array) array(27, 13, 20, 26, 24);
     $rows = (array) array();
     foreach ($required_fleets as $fleetId) {
         $url = $apiurl . "&Fleet=" . $fleetId;
         $fileParser = new FileParser($url);
         $fileParser->setCurlFile("fleet_truck_count_" . $fleetId . ".csv");
         $data = $fileParser->parseFile();
         $cnt = count($data);
         $rows[] = array("fleet_id" => $fleetId, "count" => $cnt, "t24" => 1);
         unset($s);
         unset($cnt);
     }
     //: Delete rows where t24=1
     $sql = (string) "DELETE FROM `fleet_truck_count` WHERE `t24`=1";
     $manager->runSql($sql);
     $manager->insert($rows);
 }
 public function setHtml($html = null)
 {
     if (is_string($html) === false) {
         $html = null;
     }
     if ($html === null) {
         $gallery = new TableManager("gallery");
         $list = $gallery->selectMultiple();
         $html = (string) "<div class=\"standard content1\" style=\"margin-bottom:10px;width:500px;\">";
         $html .= "<div onclick=\"toggle('scaffoldSearchForm');var text = (this.firstChild.nodeValue.match(/Display*/) ? 'Hide Search Form' : 'Display Search Form');clearAllElements(this);this.appendChild(document.createTextNode(text));\" style=\"cursor:pointer;text-align:center;\">";
         $html .= "Display Search Form";
         $html .= "</div>";
         $html .= "<form id=\"scaffoldSearchForm\" method=\"POST\" style=\"display:none;\">";
         $html .= "<label for=\"name\">Name</label>";
         $html .= "<input id=\"name\" name=\"name\" type=\"text\" value=\"" . ($_POST ? $_POST["name"] : "") . "\" /><br />" . PHP_EOL;
         $html .= "<label for=\"gallery_id\">Gallery</label>";
         $html .= "<select id=\"gallery_id\" name=\"gallery_id\" style=\"width:200px;\">";
         $html .= "<option value=\"0\">Please select..</option>";
         foreach ($list as $val) {
             $html .= "<option" . ($_POST && $val["id"] == $_POST["gallery_id"] ? " selected=\"selected\"" : "") . " value=\"" . $val["id"] . "\">" . $val["name"] . "</option>";
         }
         $html .= "</select><br />";
         $html .= "<label for=\"deleted\">Include deleted?</label>";
         $html .= "<input" . ($_POST && $_POST["deleted"] ? " checked=\"checked\"" : "") . " id=\"deleted\" name=\"deleted\" type=\"checkbox\" value=\"1\" />" . PHP_EOL;
         $html .= "</form>";
         $html .= "</div>" . PHP_EOL;
     }
     $this->_html = $html;
 }
Example #5
0
 /** Scaffold_Forms_GalleryItems::setHtml($html = null)
  * @param string $html HTML form definition
  */
 public function setHtml($html = null)
 {
     if ($html === null) {
         $record = self::getRecord();
         if (is_object("TableManager") === false) {
             include_once BASE . DIRECTORY_SEPARATOR . "basefunctions" . DIRECTORY_SEPARATOR . "baseapis" . DIRECTORY_SEPARATOR . "TableManager.php";
         }
         $tableManager = new TableManager("gallery");
         $tableManager->setWhere("ISNULL(`gallery`.`deleted`)" . $tableManager->quoteString(" OR `gallery`.`deleted`=?", (int) 0));
         $gallery = $tableManager->selectMultiple();
         $html = (string) "<script type=\"text/javascript\" src=\"" . BASE . DIRECTORY_SEPARATOR . "basefunctions" . DIRECTORY_SEPARATOR . "scripts" . DIRECTORY_SEPARATOR . "ajax_file_upload.js\"></script>" . PHP_EOL;
         $html .= "<noscript><p class=\"error\">I'm sorry but you need to enable javascript for this to work correctly.</p></noscript>" . PHP_EOL;
         $html .= "<form encoding=\"multipart/form-data\" enctype=\"multipart/form-data\" id=\"uploaderForm\" method=\"POST\" style=\"width:750px;\">" . PHP_EOL;
         $html .= "<div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "<label for=\"gallery_id\" style=\"color:#000;\">Gallery</label>" . PHP_EOL;
         $html .= "<select id=\"gallery_id\" name=\"gallery_id\">" . PHP_EOL;
         $html .= "<option value=\"0\">Please select...</options>" . PHP_EOL;
         foreach ($gallery as $gall) {
             $html .= "<option value=\"" . $gall["id"] . "\"" . ($record && $record["gallery_id"] == $gall["id"] ? " selected=\"selected\"" : "") . ">" . $gall["name"] . "</option>" . PHP_EOL;
         }
         $html .= "</select><br class=\"clear\" />" . PHP_EOL;
         ### File uploader | directory uploader
         $html .= "<fieldset style=\"float:left;margin-right:5px;width:" . ($record ? "97%" : "450px") . ";\">";
         $html .= "<legend>Upload file(s)</legend>";
         /* File uploader segment */
         $html .= "<label for=\"uploadFile\" style=\"color:#000;\">Choose file....</label>";
         $html .= "<input id=\"uploadFile\" name=\"uploadFile\" type=\"file\" />";
         $html .= "<button id=\"uploadButton\" onclick=\"return ajaxFileUpload.startUpload('uploaderForm', this);\">Upload....</button>";
         /* File uploader segment */
         $html .= "</fieldset>";
         if (!$record) {
             $html .= "<fieldset style=\"float:left;margin-right:5px;width:250px;\">";
             $html .= "<legend>Search a directory</legend>";
             $html .= "<label for=\"directory\" style=\"color:#000;\">Directory path</label>";
             $html .= "<input id=\"directory\" name=\"directory\" type=\"text\" />";
             $file = (string) substr(__DIR__, 0, strrpos(__DIR__, DIRECTORY_SEPARATOR) + 1) . "pastLocations.txt";
             if (is_file($file)) {
                 $data = file($file);
                 if ($data) {
                     $html .= "<ul style=\"list-style-position:outside;margin-left:20px;\">";
                     foreach ($data as $line) {
                         $html .= "<li onclick=\"document.getElementById('directory').value = this.firstChild.nodeValue;\" style=\"cursor:pointer;\">" . $line . "</li>";
                     }
                     $html .= "</ul>";
                 }
             }
             $html .= "</fieldset>";
         }
         ### End
         $html .= "<br style=\"clear:both;\" /><br style=\"clear:both;\" /><div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "</form>";
         $html .= "<script type=\"text/javascript\">\n      ajaxFileUpload.setReturnDataFormat({\n      name:'" . ($record ? "file" : "file[]") . "'\n      });\n      ajaxFileUpload.setLocation(\"/Maxine/gallery/\");\n      ajaxFileUpload.enableForm('uploaderForm');\n      </script>";
     }
     $this->_html = $html;
 }
 /** Scaffold_Forms_Documents::setHtml($html = null)
  * @param string $html HTML form definition
  */
 public function setHtml($html = null)
 {
     if ($html === null) {
         $record = self::getRecord();
         if (is_object("TableManager") === false) {
             include_once BASE . DIRECTORY_SEPARATOR . "basefunctions" . DIRECTORY_SEPARATOR . "baseapis" . DIRECTORY_SEPARATOR . "TableManager.php";
         }
         $tableManager = new TableManager("m3_departments");
         $tableManager->setWhere($tableManager->quoteString("`display`=?", 1));
         $departments = $tableManager->selectMultiple();
         $tableManager = new TableManager("type");
         $tableManager->setWhere("ISNULL(`deleted`)");
         $types = $tableManager->selectMultiple();
         $html = (string) "<script type=\"text/javascript\" src=\"" . BASE . DIRECTORY_SEPARATOR . "basefunctions" . DIRECTORY_SEPARATOR . "scripts" . DIRECTORY_SEPARATOR . "ajax_file_upload.js\"></script>" . PHP_EOL;
         $html .= "<noscript><p class=\"error\">I'm sorry but you need to enable javascript for this to work correctly.</p></noscript>" . PHP_EOL;
         $html .= "<form method=\"POST\" id=\"uploaderForm\">" . PHP_EOL;
         $html .= "<div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "<label for=\"departments_id\" style=\"color:#000;\">Department</label>" . PHP_EOL;
         $html .= "<select id=\"departments_id\" name=\"departments_id\">" . PHP_EOL;
         $html .= "<option value=\"0\">Please select...</options>" . PHP_EOL;
         foreach ($departments as $dept) {
             $html .= "<option value=\"" . $dept["id"] . "\"" . ($record && $record["department_id"] == $dept["id"] ? " selected=\"selected\"" : "") . ">" . $dept["name"] . "</option>" . PHP_EOL;
         }
         $html .= "</select><br class=\"clear\" />" . PHP_EOL;
         $html .= "<label for=\"type_id\" style=\"color:#000;\">Document type</label>" . PHP_EOL;
         $html .= "<select id=\"type_id\" name=\"type_id\">" . PHP_EOL;
         $html .= "<option value=\"0\">Please select...</options>" . PHP_EOL;
         if ($types && is_array($types)) {
             foreach ($types as $type) {
                 $html .= "<option value=\"" . $type["id"] . "\"" . ($record && $record["type_id"] == $type["id"] ? " selected=\"selected\"" : "") . ">" . $type["name"] . "</option>" . PHP_EOL;
             }
         }
         $html .= "</select><br class=\"clear\" />" . PHP_EOL;
         $html .= "<label for=\"name[0]\" style=\"color:#000;\">Name</label>" . PHP_EOL;
         $html .= "<input type=\"text\" class=\"standard\" id=\"name[0]\" name=\"name\" readonly=\"readonly\" value=\"" . ($record ? $record["name"] : "") . "\" /><br />" . PHP_EOL;
         $html .= "<label for=\"location_file\" style=\"color:#000;\">Location</label>" . PHP_EOL;
         $location = (string) "documents/";
         $html .= "<input type=\"file\" id=\"location_file\" name=\"location_file\" readonly=\"readonly\" onchange=\"document.getElementById('name[0]').value = this.value.toString().substring(0, this.value.toString().lastIndexOf('.'));\" />" . PHP_EOL;
         $html .= "<input type=\"hidden\" name=\"location\" id=\"location\" />" . PHP_EOL;
         $html .= "<button onclick=\"ajaxFileUpload.doUpload('" . $location . "', 'location', 'location_file'); return false;\">Upload</button>" . PHP_EOL;
         $html .= "<br />" . PHP_EOL;
         $html .= "<div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "</form>" . PHP_EOL;
         //$html .= "<iframe id=\"targetFrame\" name=\"targetFrame\"></iframe>".PHP_EOL;
         $html .= "<iframe id=\"targetFrame\" name=\"targetFrame\" style=\"display:none;\"></iframe>" . PHP_EOL;
         $html .= "<p id=\"upload_process\" style=\"display:none;\"><img src=\"" . BASE . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . "loading.gif\" alt=\"Loading\" title=\"Please be patient. Uploading your file can take a bit of time\" /></p>" . PHP_EOL;
     }
     $this->_html = $html;
 }
Example #7
0
 /** Scaffold_Forms_Pages::setHtml($html = null)
  * @param string $html HTML form definition
  */
 public function setHtml($html = null)
 {
     if ($html === null) {
         $record = self::getRecord();
         $tableManager = new TableManager("m3_departments");
         $tableManager->setWhere($tableManager->quoteString("`display`=?", 1));
         $departments = $tableManager->selectMultiple();
         $tableManager = new TableManager("pages");
         $tableManager->setWhere($tableManager->quoteString("(ISNULL(`pages`.`deleted`) OR `pages`.`deleted`=?)", (int) 0));
         $pages = $tableManager->selectMultiple();
         $tableManager = new TableManager("type");
         $tableManager->setWhere("ISNULL(`deleted`)");
         $pagetypes = $tableManager->selectMultiple();
         $html = (string) "<script type=\"text/javascript\" src=\"http://" . $_SERVER["SERVER_NAME"] . "/basefunctions/scripts/nicEdit.js\"></script>" . PHP_EOL;
         $html .= "<form method=\"POST\">" . PHP_EOL;
         $html .= "<div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "<label for=\"name\" style=\"color:#000;\">Name</label>" . PHP_EOL;
         $html .= "<input type=\"text\" id=\"name\" name=\"name\" value=\"" . ($record ? $record["name"] : "") . "\" /><br />" . PHP_EOL;
         $html .= "<label for=\"departments_id\" style=\"color:#000;\">Department</label>" . PHP_EOL;
         $html .= "<select id=\"departments_id\" name=\"departments_id\">" . PHP_EOL;
         $html .= "<option value=\"0\">Please select...</options>" . PHP_EOL;
         foreach ($departments as $dept) {
             $html .= "<option value=\"" . $dept["id"] . "\"" . ($record && $record["departments_id"] == $dept["id"] ? " selected=\"selected\"" : "") . ">" . $dept["name"] . "</option>" . PHP_EOL;
         }
         $html .= "</select><br class=\"clear\" />" . PHP_EOL;
         $html .= "<label for=\"type_id\" style=\"color:#000;\">Page type</label>" . PHP_EOL;
         $html .= "<select id=\"type_id\" name=\"type_id\">" . PHP_EOL;
         $html .= "<option value=\"0\">Please select...</options>" . PHP_EOL;
         foreach ($pagetypes as $type) {
             $html .= "<option value=\"" . $type["id"] . "\"" . ($record && $record["type_id"] == $type["id"] ? " selected=\"selected\"" : "") . ">" . $type["name"] . "</option>" . PHP_EOL;
         }
         $html .= "</select><br class=\"clear\" />" . PHP_EOL;
         $html .= "<label for=\"parent_id\" style=\"color:#000;\">Parent page</label>" . PHP_EOL;
         $html .= "<select id=\"parent_id\" name=\"parent_id\">" . PHP_EOL;
         $html .= "<option value=\"0\">Please select...</options>" . PHP_EOL;
         foreach ($pages as $page) {
             $html .= "<option value=\"" . $page["id"] . "\"" . ($record && $record["parent_id"] == $page["id"] ? " selected=\"selected\"" : "") . ">" . $page["name"] . "</option>" . PHP_EOL;
         }
         $html .= "</select><br class=\"clear\" />" . PHP_EOL;
         $html .= "<label for=\"content\" style=\"color:#000;\">Content</label><br style=\"clear:both;\" />" . PHP_EOL;
         $html .= "<textarea id=\"content\" name=\"content\" style=\"height:200px;width:400px;\">" . ($record ? $record["content"] : "") . "</textarea><br />" . PHP_EOL;
         $html .= "<div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "</form>" . PHP_EOL;
         $html .= "<iframe id=\"frameLoader\" style=\"display:none;\">&nbsp;</iframe>";
         $html .= "<script type=\"text/javascript\">document.getElementById('frameLoader').onload = function () {\n      var content = new nicEditor({\n      uploadURI: 'http://" . $_SERVER["SERVER_NAME"] . "/Maxine/scaffold/nicUpload.php',\n      fullPanel: true\n      }).panelInstance('content',{hasPanel : true})\n      }</script>" . PHP_EOL;
     }
     $this->_html = $html;
 }
Example #8
0
 /** Scaffold_Forms_Documents::setHtml($html = null)
  * @param string $html HTML form definition
  */
 public function setHtml($html = null)
 {
     if ($html === null) {
         $record = self::getRecord();
         if (is_object("TableManager") === false) {
             include_once BASE . DIRECTORY_SEPARATOR . "basefunctions" . DIRECTORY_SEPARATOR . "baseapis" . DIRECTORY_SEPARATOR . "TableManager.php";
         }
         $tableManager = new TableManager("m3_departments");
         $departments = $tableManager->selectMultiple();
         $tableManager = new TableManager("type");
         $tableManager->setWhere($tableManager->quoteString("(ISNULL(`deleted`) OR `deleted`=?)", (int) 0));
         $types = $tableManager->selectMultiple();
         $html = (string) "<script type=\"text/javascript\" src=\"" . BASE . DIRECTORY_SEPARATOR . "basefunctions" . DIRECTORY_SEPARATOR . "scripts" . DIRECTORY_SEPARATOR . "ajax_file_upload.js\"></script>" . PHP_EOL;
         $html .= "<noscript><p class=\"error\">I'm sorry but you need to enable javascript for this to work correctly.</p></noscript>" . PHP_EOL;
         $html .= "<form encoding=\"multipart/form-data\" enctype=\"multipart/form-data\" id=\"uploaderForm\" method=\"POST\">" . PHP_EOL;
         $html .= "<div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "<label for=\"departments_id\" style=\"color:#000;\">Department</label>" . PHP_EOL;
         $html .= "<select id=\"departments_id\" name=\"departments_id\">" . PHP_EOL;
         $html .= "<option value=\"0\">Please select...</options>" . PHP_EOL;
         foreach ($departments as $dept) {
             $html .= "<option value=\"" . $dept["id"] . "\"" . ($record && $record["departments_id"] == $dept["id"] ? " selected=\"selected\"" : "") . ">" . $dept["name"] . "</option>" . PHP_EOL;
         }
         $html .= "</select><br class=\"clear\" />" . PHP_EOL;
         $html .= "<label for=\"type_id\" style=\"color:#000;\">Document type</label>" . PHP_EOL;
         $html .= "<select id=\"type_id\" name=\"type_id\">" . PHP_EOL;
         $html .= "<option value=\"0\">Please select...</options>" . PHP_EOL;
         if ($types && is_array($types)) {
             foreach ($types as $type) {
                 $html .= "<option value=\"" . $type["id"] . "\"" . ($record && $record["type_id"] == $type["id"] ? " selected=\"selected\"" : "") . ">" . $type["name"] . "</option>" . PHP_EOL;
             }
         }
         $html .= "</select><br class=\"clear\" />" . PHP_EOL;
         /* File uploader segment */
         $html .= "<label for=\"uploadFile\" style=\"color:#000;\">Choose file....</label>";
         $html .= "<input id=\"uploadFile\" name=\"uploadFile\" type=\"file\" />";
         $html .= "<button id=\"uploadButton\" onclick=\"return ajaxFileUpload.startUpload('uploaderForm', this);\">Upload....</button>";
         /* File uploader segment */
         $html .= "<br style=\"clear:both;\" /><div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "</form>" . PHP_EOL;
         $html .= "<script type=\"text/javascript\">\n      ajaxFileUpload.setReturnDataFormat({\n        name:'" . ($record ? "location" : "location[]") . "'\n      });\n      ajaxFileUpload.setLocation(\"/Maxine/documents/\");\n      ajaxFileUpload.enableForm('uploaderForm');\n      </script>";
     }
     $this->_html = $html;
 }
 public function setHtml($html = null)
 {
     if ($html === null) {
         $departments = new TableManager("m3_departments");
         $themes = new TableManager("themes");
         $list = $departments->selectMultiple();
         $list2 = $themes->selectMultiple();
         $html = (string) "<div class=\"standard content1\" style=\"margin-bottom:10px;width:500px;\">";
         $html .= "<div onclick=\"toggle('scaffoldSearchForm');var text = (this.firstChild.nodeValue.match(/Display*/) ? 'Hide Search Form' : 'Display Search Form');clearAllElements(this);this.appendChild(document.createTextNode(text));\" style=\"cursor:pointer;text-align:center;\">";
         $html .= "Display Search Form";
         $html .= "</div>";
         $html .= "<form id=\"scaffoldSearchForm\" method=\"POST\" style=\"display:none;\">";
         $html .= "<label for=\"staffno\">Staff No.</label>";
         $html .= "<input id=\"staffno\" name=\"staffno\" type=\"text\" value=\"" . ($_POST ? $_POST["staffno"] : "") . "\" /><br />" . PHP_EOL;
         $html .= "<label for=\"firstname\">First Name</label>";
         $html .= "<input id=\"firstname\" name=\"firstname\" type=\"text\" value=\"" . ($_POST ? $_POST["firstname"] : "") . "\" /><br />" . PHP_EOL;
         $html .= "<label for=\"lastname\">Last Name</label>";
         $html .= "<input id=\"lastname\" name=\"lastname\" type=\"text\" value=\"" . ($_POST ? $_POST["lastname"] : "") . "\" /><br />" . PHP_EOL;
         $html .= "<label for=\"department_id\">Department</label>";
         $html .= "<select id=\"department_id\" name=\"department_id\">";
         $html .= "<option value=\"0\">Please select..</option>";
         foreach ($list as $val) {
             $html .= "<option" . ($_POST && $val["id"] == $_POST["department_id"] ? " selected=\"selected\"" : "") . " value=\"" . $val["id"] . "\">" . $val["name"] . "</option>";
         }
         $html .= "</select><br />";
         $html .= "<label for=\"jobtitle\">Position</label>";
         $html .= "<input id=\"jobtitle\" name=\"jobtitle\" type=\"text\" value=\"" . ($_POST ? $_POST["jobtitle"] : "") . "\" /><br />" . PHP_EOL;
         $html .= "<label for=\"location\">Location</label>";
         $html .= "<input id=\"location\" name=\"location\" type=\"text\" value=\"" . ($_POST ? $_POST["location"] : "") . "\" /><br />" . PHP_EOL;
         $html .= "<label for=\"theme_id\">Theme</label>";
         $html .= "<select id=\"theme_id\" name=\"theme_id\">";
         $html .= "<option value=\"0\">Please select..</option>";
         foreach ($list2 as $val) {
             $html .= "<option" . ($_POST && $val["id"] == $_POST["theme_id"] ? " selected=\"selected\"" : "") . " value=\"" . $val["id"] . "\">" . $val["name"] . "</option>";
         }
         $html .= "</select><br />";
         $html .= "<label for=\"deleted\">Include deleted?</label>";
         $html .= "<input" . ($_POST && $_POST["deleted"] ? " checked=\"checked\"" : "") . " id=\"deleted\" name=\"deleted\" type=\"checkbox\" value=\"1\" />" . PHP_EOL;
         $html .= "</form>";
         $html .= "</div>";
     }
     $this->_html = $html;
 }
 public function setManager(TableManager $manager = NULL)
 {
     if ($manager === NULL) {
         $test = new TableManager();
         ## Test to see if the sessions table exists and if not create it
         $sql = (string) "SHOW TABLES LIKE 's%'";
         if (($tables = $test->runSql($sql)) === FALSE) {
             return FALSE;
         }
         if ($tables) {
             $exists = (bool) FALSE;
             foreach ($tables as $tbl) {
                 $keys = array_keys($tbl);
                 if ($tbl[$keys[0]] == "sessions") {
                     $exists = TRUE;
                     break;
                 }
             }
             if ($exists === FALSE) {
                 $sql = (string) "CREATE TABLE IF NOT EXISTS `sessions` (";
                 $sql .= "`id` INT(32) NOT NULL AUTO_INCREMENT PRIMARY KEY,";
                 $sql .= "`session_id` VARCHAR(150) NOT NULL DEFAULT '' UNIQUE,";
                 $sql .= "`access` INT(32) NOT NULL DEFAULT 0,";
                 $sql .= "`data` LONGTEXT,";
                 $sql .= "`ip_address` VARCHAR(15) NOT NULL DEFAULT '000.000.000.000',";
                 $sql .= "INDEX (`access`),";
                 $sql .= "INDEX (`ip_address`)";
                 $sql .= ") ENGINE=INNODB DEFAULT CHARSET=UTF8;";
                 if ($test->runSql($sql) === FALSE) {
                     print "<pre>";
                     print_r($test->getErrors());
                     print "</pre>";
                     return FALSE;
                 }
             }
         }
         $test->__destruct();
         unset($test);
         $manager = new TableManager("sessions");
     }
     $this->_manager = $manager;
 }
Example #11
0
 /**
  * sets pvausearchterms for user ID
  *
  *@throws MySQLConnectionException if a problem with MySQL happened
  */
 function SetSearchterms($uid, $searchterms)
 {
     $searchterms = str_replace('"', '\'', $searchterms);
     if (isset($uid)) {
         if ($this->existsEntry("ID", $uid)) {
             parent::alterEntry($uid, 'searchterms', sql_prev_inj($searchterms));
         } else {
             $this->addEntry("ID", $uid, "searchterms", sql_prev_inj($searchterms));
             return false;
         }
     }
 }
Example #12
0
function exportFleetScoreUpdates()
{
    require_once BASE . 'basefunctions/baseapis/PHPExcel/php-excel.class.php';
    $manager = new TableManager("fleet_scores");
    $data = __sanitizeData($_GET);
    $where = (string) "1=1";
    if (isset($data["fleet"]) && $data["fleet"]) {
        $where .= $manager->quoteString(" AND `fleetid`=?", (int) $data["fleet"]);
    }
    if (isset($data["start"]) && $data["start"]) {
        $where .= $manager->quoteString(" AND `date`>=?", (int) unixDate($data["start"]));
    }
    if (isset($data["end"]) && $data["end"]) {
        $where .= $manager->quoteString(" AND `date`<=?", (int) unixDate($data["end"]));
    }
    $manager->setWhere($where);
    $manager->setOrderBy(array("column" => "date"));
    $records = $manager->selectMultiple();
    $rows = returnFleetTruckCount();
    $xlsdata = (array) array();
    $fleetdayobj = new fleetDayHandler();
    $tempfleetlist = $fleetdayobj->getIncomeFleets();
    $fleetlist = array();
    foreach ($tempfleetlist as $tempkey => $tempval) {
        $fleetlist[$tempval["id"]] = $tempval;
    }
    unset($tempfleetlist);
    unset($fleetdayobj);
    $row = (array) array("Date", "Fleet", "Income budget", "Income", "Contribution budget", "Contribution", "Truck count", "Kms", "Ave. Kms per truck", "Budget Ave. Kms per truck");
    $xlsdata[] = $row;
    foreach ($records as $val) {
        $row = (array) array(date("Y-m-d", $val["date"]), $fleetlist[$val["fleetid"]]["name"], $val["budget"], $val["income"], $val["budgetcontrib"], $val["contrib"], $rows[$val["fleetid"]]["count"], $val["kms"], round($val["kms"] / (isset($rows[$val["fleetid"]]) && isset($rows[$val["fleetid"]]["count"]) ? $rows[$val["fleetid"]]["count"] : 1), 2), round($val["budkms"] / (isset($rows[$val["fleetid"]]) && isset($rows[$val["fleetid"]]["count"]) ? $rows[$val["fleetid"]]["count"] : 1), 2));
        $xlsdata[] = $row;
    }
    $xls = new Excel_XML('UTF-8', TRUE);
    $xls->addArray($xlsdata);
    $xls->generateXML('fleet_score_data');
}
Example #13
0
 /**
  * returns the Orders that are dated [mealdate] between the first and the second Date
  * Format can be timestamp or YYYY-MM-DD
  */
 function getOrdersBetMealdate($startdate, $enddate)
 {
     ///@todo sicher das Timestamp hier von MySQL automatisch konvertiert wird?
     return parent::getTableData(sprintf('mealdate BETWEEN %s AND %s', $startdate, $enddate));
 }
Example #14
0
 /**
  * Returns the number of CardID-changes
  * Enter description here ...
  * @param numeric_string $ID
  * @return numeric value of changed_cardID for the given object
  * @throws Exception if something has gone wrong
  */
 function getCardIDChanges($ID)
 {
     $card = parent::getEntryData($ID);
     if (isset($card['changed_cardID'])) {
         return $card['changed_cardID'];
     } else {
         throw new Exception('could not get the value changed_cardID');
     }
 }
Example #15
0
 /**
  * edit a book entry by given id
  */
 function editBook($id, $subjectId, $class, $title, $author, $publisher, $isbn, $price, $bundle)
 {
     parent::alterEntry($id, 'subjectId', $subjectId, 'class', $class, 'title', $title, 'author', $author, 'publisher', $publisher, 'isbn', $isbn, 'price', $price, 'bundle', $bundle);
 }
Example #16
0
 /**
  * Adds a Meal
  * Adds a meal into the MySQL-meal-table based on the given parameters...
  * @param string $name
  * @param string $description
  * @param YYYY-MM-DD $date_conv
  * @param int $price_class
  * @param int $max_orders
  */
 public function addMeal($name, $description, $date_conv, $price_class, $max_orders)
 {
     parent::addEntry('name', $name, 'description', $description, 'date', $date_conv, 'price_class', $price_class, 'max_orders', $max_orders);
 }
Example #17
0
 public function __construct()
 {
     $manager = new TableManager("user_profiles");
     echo "<link href=\"http://" . $_SERVER["SERVER_NAME"] . "/basefunctions/scripts/manline.css\" media=\"all\" rel=\"stylesheet\" type=\"text/css\" />" . PHP_EOL;
     echo "<p class=\"standard\">" . PHP_EOL;
     echo "Update current records to be integer based instead of string based<br />" . PHP_EOL;
     $list = $manager->selectMultiple();
     foreach ($list as $key => $val) {
         if (!$val["birthday"]) {
             continue;
         }
         $manager->setWhere($manager->quoteString("`user_profiles`.`id`=?", $val["id"]));
         $data = (array) array();
         $split = preg_split("/\\s/", $val["birthday"]);
         $data["birthday"] = mktime(0, 0, 0, date("m", strtotime("01-" . $split[1] . "-2011")), $split[0], 2011);
         if ($manager->update($data) === false) {
             echo "<span style=\"color:#F00;\" title=\"Update failed\">|</span>" . PHP_EOL;
             return false;
         }
         echo "<span style=\"color:#FFF;\" title=\"Update successful\">|</span>" . PHP_EOL;
         $manager->setWhere("");
         ## TOCTOU Race condition ##
     }
     echo "<br />Update table so that the birthday column is an integer column<br />" . PHP_EOL;
     $sql = (string) "alter table user_profiles modify column birthday int(50) not null default '0',add index (`birthday`);";
     if ($manager->runSql($sql) === false) {
         echo "<echo style=\"color:#FFF;\">" . PHP_EOL;
         print_r($manager->getErrors());
         echo "</pre>" . PHP_EOL;
         return false;
     }
     echo "<br />Get list of users<br />" . PHP_EOL;
     $sql = (string) "SELECT * FROM `users` WHERE `deleted`='0'";
     if (($list = $manager->runSql($sql)) === false) {
         echo "<echo style=\"color:#FFF;\">" . PHP_EOL;
         print_r($manager->getErrors());
         echo "</pre>" . PHP_EOL;
         return false;
     }
     echo "<br />Loop through and get the userdates entry for birthday and update the user_profiles table.<br />" . PHP_EOL;
     foreach ($list as $key => $val) {
         if (!$val["user_profiles_id"]) {
             continue;
         }
         $sql = (string) "SELECT * FROM `userdates` WHERE `userid`='" . $val["personid"] . "'  AND `datetype`='birthday' LIMIT 1";
         if (($row = $manager->runSql($sql)) === false) {
             echo "<echo style=\"color:#FFF;\">" . PHP_EOL;
             print_r($manager->getErrors());
             echo "</pre>" . PHP_EOL;
             return false;
         }
         $manager->setWhere($manager->quoteString("`user_profiles`.`id`=?", $val["user_profiles_id"]));
         $data = (array) array();
         $birthday = date("Y-m-d", $row[0]["date"]);
         $split = preg_split("/\\-/", $birthday);
         $data["birthday"] = strtotime("1971-" . $split[1] . "-" . $split[2]);
         if ($manager->update($data) === false) {
             echo "<span style=\"color:#F00;\" title=\"Update failed\">|</span>" . PHP_EOL;
             return false;
         }
         echo "<span style=\"color:#FFF;\" title=\"Update successful\">|</span>" . PHP_EOL;
         $manager->setWhere("");
         ## TOCTOU Race condition ##
     }
     echo "<br />Get any records form the user_profiles table where the birthday year isn't 1971<br />" . PHP_EOL;
     $manager->setWhere($manager->quoteString("DATE_FORMAT(FROM_UNIXTIME(`user_profiles`.`birthday`), '%Y')!=?", 1971));
     $list = $manager->selectMultiple();
     foreach ($list as $key => $val) {
         $manager->setWhere($manager->quoteString("`user_profiles`.`id`=?", $val["id"]));
         $date = date("Y-m-d", $val["birthday"]);
         $split = preg_split("/\\-/", $date);
         $data = (array) array("birthday" => strtotime("1971-" . $split[1] . "-" . $split[2]));
         if ($manager->update($data) === false) {
             echo "<span style=\"color:#F00;\" title=\"Update failed\">|</span>" . PHP_EOL;
             return false;
         }
         echo "<span style=\"color:#FFF;\" title=\"Update successful\">|</span>" . PHP_EOL;
         $manager->setWhere("");
         ## TOCTOU Race condition ##
     }
 }
function updateUserHistory($config)
{
    if ($config["userid"]) {
        $data["userid"] = $config["userid"];
    }
    if ($config["actionid"]) {
        $data["actionid"] = $config["actionid"];
    }
    if ($config["comment"]) {
        $data["comment"] = $config["comment"];
    }
    if ($config["fromdate"]) {
        $data["fromdate"] = $config["fromdate"];
    }
    if ($config["todate"]) {
        $data["todate"] = $config["todate"];
    }
    $data["date"] = date("U");
    /* if($done = sqlCreate(array("table"=>"userhistory", "fields"=>$data))) {
    				$available = sqlPull(array("table"=>"useractions", "where"=>"id=".$config["actionid"], "onerow"=>"1"));
    				$userdata["available"] = $available["callme"];
    				
    				sqlCommit(array("table"=>"users", "where"=>"personid=".$config["userid"], "fields"=>$userdata));
    			} */
    $userhistory = new TableManager("userhistory");
    $function = (string) "insert";
    if ($config["id"]) {
        ## we are updating a record
        $userhistory->setWhere($userhistory->quoteString("`userhistory`.`id`=?", intval($config["id"])));
        $function = "update";
    }
    if ($userhistory->{$function}($data) === false) {
        throw new man_exception("Could not successfully query the database");
    }
    $actions = new TableManager("useractions");
    $actions->setWhere($actions->quoteString("`useractions`.`id`=?", $config["actionid"]));
    $action = $actions->selectSingle();
    $users = new TableManager("users");
    $users->setWhere($users->quoteString("`users`.`personid`=?", $config["userid"]));
    $data = (array) array("available" => $action["callme"]);
    $users->update($data);
}
Example #19
0
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>";
    }
    // }
}
Example #20
0
 public function setColor($pc_ID, $color)
 {
     try {
         $ids = TableManager::getTableData(sprintf("pc_ID=%s", $pc_ID));
         foreach ($ids as &$id) {
             TableManager::alterEntry($id['ID'], 'color', $color);
         }
     } catch (Exception $e) {
         echo "Error getting priceclass: " . $e->getMessage();
         die;
     }
 }
 /** Scaffold_Forms_User_profiles::setHtml($html = null)
  * @param string $html HTML form definition
  */
 public function setHtml($html = null)
 {
     if ($html === null) {
         ## Preparation
         $record = self::getRecord();
         if (is_object("TableManager") === false) {
             include_once BASE . DIRECTORY_SEPARATOR . "basefunctions" . DIRECTORY_SEPARATOR . "baseapis" . DIRECTORY_SEPARATOR . "TableManager.php";
         }
         $tableManager = new TableManager("m3_departments");
         $departments = $tableManager->selectMultiple();
         $sql = (string) "SELECT * FROM `themes` WHERE (ISNULL(`deleted`) OR `deleted`=0)";
         $themes = $tableManager->runSql($sql);
         $users = new TableManager("users");
         $metaData = $users->getMetaData();
         if ($record) {
             $users->setChildRecords(true);
             $users->setChildTables(array(0 => array("rights_users" => "rights_users", "where" => "`rights_users`.`userid`=?")));
             $users->setWhere($users->quoteString("`users`.`user_profiles_id`=?", (int) $record["id"]));
             $user = $users->selectSingle();
         }
         $sql = (string) "SELECT * FROM `rights_groups` WHERE 1=1;";
         $rights_groups = $users->runSql($sql);
         ## End
         $html = (string) "<form enctype=\"multipart/form-data\" method=\"POST\">" . PHP_EOL;
         $html .= "<div style=\"width:800px;\">" . PHP_EOL;
         $html .= "<div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         ## Profile details
         $html .= "<fieldset style=\"width:730px;\">";
         $html .= "<legend>Profile details</legend>";
         $html .= "<div style=\"border:none;float:left;width:49%;\">";
         $html .= "<label for=\"staffno\" style=\"color:#000;width:150px;\">Staff Number</label>" . PHP_EOL;
         $html .= "<input id=\"staffno\" name=\"staffno\" " . ($record["staffno"] ? "readonly=\"readonly\" " : "") . "type=\"text\" value=\"" . ($record["staffno"] ? $record["staffno"] : "") . "\"><br style=\"clear:both;\" />" . PHP_EOL;
         $html .= "<label for=\"firstname\" style=\"color:#000;width:150px;\">First name</label>" . PHP_EOL;
         $html .= "<input id=\"firstname\" name=\"firstname\" type=\"text\" value=\"" . ($record["firstname"] ? $record["firstname"] : "") . "\"><br />" . PHP_EOL;
         $html .= "<label for=\"day\" style=\"color:#000;width:150px;\">Birthday</label>" . PHP_EOL;
         $html .= "<select id=\"day\" name=\"day\" style=\"float:left;margin-bottom:5px;width:50px;\">";
         $html .= "<option value=\"0\">Day</option>" . PHP_EOL;
         for ($i = 1; $i < 32; $i++) {
             $html .= "<option " . ($record["birthday"] && date("d", $record["birthday"]) == $i ? "selected=\"selected\" " : "") . "value=\"" . (strlen($i) == 1 ? "0" . $i : $i) . "\">" . (strlen($i) == 1 ? "0" . $i : $i) . "</option>";
         }
         $html .= "</select>";
         $html .= "<select id=\"month\" name=\"month\" style=\"float:left;width:120px;\">";
         $html .= "<option value=\"0\">Month</option>" . PHP_EOL;
         for ($i = 1; $i < 13; $i++) {
             $html .= "<option " . ($record["birthday"] && date("F", $record["birthday"]) == date("F", mktime(0, 0, 0, $i, 1, 2000)) ? "selected=\"selected\" " : "") . "value=\"" . date("m", mktime(0, 0, 0, $i, 1, 2000)) . "\">" . date("F", mktime(0, 0, 0, $i, 1, 2000)) . "</option>";
         }
         $html .= "</select><br style=\"clear:both;\" />";
         $html .= "<label for=\"department_id\" style=\"color:#000;width:150px\">Department</label>" . PHP_EOL;
         $html .= "<select id=\"department_id\" name=\"department_id\">" . PHP_EOL;
         $html .= "<option value=\"0\">Please select...</options>" . PHP_EOL;
         foreach ($departments as $dept) {
             $html .= "<option value=\"" . $dept["id"] . "\"" . ($record && $record["department_id"] == $dept["id"] ? " selected=\"selected\"" : "") . ">" . $dept["name"] . "</option>" . PHP_EOL;
         }
         $html .= "</select><br class=\"clear\" />" . PHP_EOL;
         $locations = (array) array(0 => array("name" => "Head Office"), 1 => array("name" => "Durban"), 2 => array("name" => "Empangeni"), 3 => array("name" => "East London"), 4 => array("name" => "Kokstad"), 5 => array("name" => "Pietermaritzburg"), 6 => array("name" => "Newcastle"), 7 => array("name" => "Vanderbijl Park"), 8 => array("name" => "Isando"), 9 => array("name" => "Germiston"));
         $html .= "<label for=\"location\" style=\"color:#000;width:150px;\">Location</label>" . PHP_EOL;
         $html .= "<select id=\"location\" name=\"location\" style=\"float:left;width:165px;\">" . PHP_EOL;
         foreach ($locations as $location) {
             $html .= "<option " . ($record["location"] && $record["location"] == $location["name"] ? "selected=\"selected\" " : "") . "value=\"" . $location["name"] . "\">" . $location["name"] . "</option>" . PHP_EOL;
         }
         $html .= "</select><br class=\"clear\" />" . PHP_EOL;
         $html .= "<label for=\"interests\" style=\"color:#000;\">Interests</label>" . PHP_EOL;
         $html .= "<textarea id=\"interests\" name=\"interests\">" . ($record ? $record["interests"] : "") . "</textarea><br />" . PHP_EOL;
         $html .= "<label for=\"aspirations\" style=\"color:#000;\">Aspirations</label>" . PHP_EOL;
         $html .= "<textarea id=\"aspirations\" name=\"aspirations\">" . ($record ? $record["aspirations"] : "") . "</textarea><br />" . PHP_EOL;
         $html .= "<label for=\"quote\" style=\"color:#000;\">Quote</label>" . PHP_EOL;
         $html .= "<textarea id=\"quote\" name=\"quote\">" . ($record ? $record["quote"] : "") . "</textarea><br />" . PHP_EOL;
         $html .= "</div>";
         $html .= "<div style=\"border:none;float:left;width:49%;\">";
         $html .= "<label for=\"image_file\" style=\"color:#000;width:150px;\">Image</label>" . PHP_EOL;
         $html .= "<input type=\"file\" id=\"image_file\" name=\"image\" /><br />" . PHP_EOL;
         $html .= "<label for=\"lastname\" style=\"color:#000;width:150px;\">Last name</label>" . PHP_EOL;
         $html .= "<input id=\"lastname\" name=\"lastname\" type=\"text\" value=\"" . ($record["lastname"] ? $record["lastname"] : "") . "\"><br class=\"clear\" /><br /><br />" . PHP_EOL;
         $html .= "<label for=\"jobtitle\" style=\"color:#000;width:150px\">Job Title</label>" . PHP_EOL;
         $html .= "<input type=\"text\" id=\"jobtitle\" name=\"jobtitle\" value=\"" . ($record ? $record["jobtitle"] : "") . "\" /><br />" . PHP_EOL;
         $html .= "<label for=\"family\" style=\"color:#000;\">Family</label>" . PHP_EOL;
         $html .= "<textarea id=\"family\" name=\"family\">" . ($record ? $record["family"] : "") . "</textarea><br />" . PHP_EOL;
         $html .= "<label for=\"goals\" style=\"color:#000;\">Goals</label>" . PHP_EOL;
         $html .= "<textarea id=\"goals\" name=\"goals\">" . ($record ? $record["goals"] : "") . "</textarea><br />" . PHP_EOL;
         $html .= "</div>";
         $html .= "</fieldset>";
         ## User details
         $html .= "<fieldset style=\"width:730px;\">";
         $html .= "<legend>User details</legend>";
         $html .= "<div style=\"float:left;width:49%;\">";
         $html .= "<fieldset style=\"border:none;\">";
         $html .= "<legend>Communication</legend>";
         $html .= "<label for=\"extension\" style=\"color:#000;width:150px;\">Office extension</label>";
         $html .= "<input id=\"extension\" name=\"extension\" type=\"text\" value=\"" . $user["extension"] . "\" /><br />";
         $html .= "<label for=\"cell\" style=\"color:#000;width:150px;\">Cellphone</label>";
         $html .= "<input id=\"cell\" name=\"cell\" type=\"text\" value=\"" . $user["cell"] . "\" /><br />";
         $html .= "<label for=\"email\" style=\"color:#000;width:150px;\">Email</label>";
         $html .= "<input id=\"email\" name=\"email\" type=\"email\" value=\"" . $user["email"] . "\" /><br />";
         $html .= "</fieldset>";
         $html .= "<fieldset style=\"border:none;\">";
         $html .= "<legend>Login and Password</legend>";
         if ($user) {
             $html .= "<input id=\"personid\" name=\"personid\" type=\"hidden\" value=\"" . $user["personid"] . "\" />";
         }
         $html .= "<label for=\"username\" style=\"color:#000;width:150px;\">Username</label>";
         $html .= "<input id=\"username\" name=\"username\"" . (isset($user) ? "" : " onblur=\"check.checkUsernameAvailability(this);\"") . " type=\"text\" value=\"" . $user["username"] . "\" /><br />";
         $html .= "<label for=\"pass\" style=\"color:#000;width:150px;\">Password</label>";
         $html .= "<input id=\"pass\" name=\"password\" type=\"password\" /><br />";
         $html .= "<label for=\"conpass\" style=\"color:#000;width:150px;\">Confirm password</label>";
         $html .= "<input id=\"conpass\" name=\"conpass\" type=\"password\" onblur=\"formManipulators.checkPasswordIdentical('pass', 'conpass')\" /><br />";
         $html .= "</fieldset>";
         $html .= "</div>";
         $html .= "<div style=\"float:left;width:49%;\">";
         $html .= "<fieldset style=\"border:none;\">";
         $html .= "<legend>Flags</legend>";
         if ($_SESSION["isit"]) {
             foreach ($metaData as $col => $data) {
                 if ($col == "isadmin") {
                     continue;
                 }
                 if (in_array($data["Type"], array("int(1)", "tinyint(1)"))) {
                     $html .= "<input" . ($user && $user[$col] ? " checked=\"checked\"" : "") . " id=\"" . $col . "\" name=\"" . $col . "\" type=\"checkbox\" value=\"1\" />";
                     $html .= "<label for=\"" . $col . "\" style=\"color:#000;\">" . $col . "</label><br />";
                 }
             }
         } else {
             $html .= "Cannot set access flags. Please see IT dept. to change";
         }
         $html .= "</fieldset>";
         $html .= "<fieldset style=\"border:none;\">";
         $html .= "<legend>Access Groups</legend>";
         if ($_SESSION["isit"]) {
             foreach ($rights_groups as $grp) {
                 $checked = (bool) false;
                 if (isset($user["children"]["rights_users"]) && is_array($user["children"]["rights_users"])) {
                     foreach ($user["children"]["rights_users"] as $right) {
                         if ($right['groupid'] == $grp["id"]) {
                             $checked = true;
                             break;
                         }
                     }
                 }
                 $html .= "<input" . ($checked ? " checked=\"checked\"" : "") . " id=\"" . $grp["id"] . "\" name=\"group[" . $grp["id"] . "]\" type=\"checkbox\" value=\"" . $grp["id"] . "\" />";
                 $html .= "<label for=\"" . $grp["id"] . "\" style=\"color:#000;\">" . $grp["name"] . "</label><br />";
             }
         } else {
             $html .= "Cannot set access flags. Please see IT dept. to change";
         }
         $html .= "</fieldset>";
         $html .= "</div>";
         $html .= "</fieldset>";
         $html .= "<div style=\"text-align:center;\">" . PHP_EOL;
         $html .= "<input type=\"submit\" value=\"Save\" style=\"background-color:transparent;background-image:url(" . BASE . "images/new/button.png);border:none;height:34px;width:114px;\" />" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "</div>" . PHP_EOL;
         $html .= "</form>" . PHP_EOL;
         //$html .= "<iframe id=\"targetFrame\" name=\"targetFrame\"></iframe>".PHP_EOL;
         $html .= "<iframe id=\"targetFrame\" name=\"targetFrame\" style=\"display:none;\"></iframe>" . PHP_EOL;
         $html .= "<script type=\"text/javascript\">" . PHP_EOL;
         $html .= "function selectTheme(elem) {\n\t\t  for (var i=0; i<document.getElementById('profileTheme').getElementsByTagName('IMG').length;i++) {\n\t\t  document.getElementById('profileTheme').getElementsByTagName('IMG')[i].style.border='none';\n\t\t  } \n\t\t  elem.style.border='1px solid #000';\n\t\t  }" . PHP_EOL;
         $html .= "</script>" . PHP_EOL;
     }
     $this->_html = $html;
 }
Example #22
0
 function getClassByUsername($username)
 {
     $user = parent::getTableData('username="******"');
     return $user[0]['class'];
 }
Example #23
0
 /** Maxine_Scaffold_Custom_Imports_GalleryItems::__constuct()
  * Class Constructor
  */
 public function __construct()
 {
     ## Preparation
     $base = substr(__DIR__, 0, strrpos(__DIR__, "M"));
     $gallery = new TableManager("gallery");
     $this->setLocation();
     $this->setThumbNailer();
     $this->setTableManager();
     ## The Work
     echo "<link href=\"http://" . $_SERVER["SERVER_NAME"] . "/basefunctions/scripts/manline.css\" media=\"all\" rel=\"stylesheet\" type=\"text/css\" />" . PHP_EOL;
     if ($_POST) {
         $gallery->setWhere($gallery->quoteString("(`gallery`.`name`=?", $_POST["directory"]) . $gallery->quoteString(" OR `gallery`.`name`=?)", htmlspecialchars($_POST["directory"])));
         $record = $gallery->selectSingle();
         $gallery->setWhere("");
         echo "<p class=\"standard\">" . PHP_EOL;
         $dh = dir($this->getLocation() . $_POST["directory"] . DIRECTORY_SEPARATOR);
         while (($entry = $dh->read()) !== false) {
             if (in_array($entry, array(".", ".."))) {
                 continue;
             }
             ## Copy the file from /tmp
             if (file_exists($base . "Maxine" . DS . "gallery" . DS . $entry)) {
                 unlink($base . "Maxine" . DS . "gallery" . DS . $entry);
             }
             if (copy($this->getLocation() . $_POST["directory"] . DS . $entry, $base . "Maxine" . DS . "gallery" . DS . $entry) === false) {
                 print "Copy Failed" . PHP_EOL;
                 return false;
             }
             $size = getimagesize($this->getLocation() . $_POST["directory"] . DS . $entry);
             ## Insert into the database
             $data = (array) array();
             $data["gallery_id"] = $record["id"];
             $data["file"] = "gallery" . DS . $entry;
             $data["name"] = substr($entry, 0, strrpos($entry, "."));
             if ($size[0] > $size[1]) {
                 $data["is_landscape"] = 1;
             }
             $this->getTableManager()->insert($data);
             ## Make the thumbnails
             $this->getThumbNailer()->setLocation($base . "Maxine" . DS . "gallery" . DS . "thumbnails" . DS);
             $this->getThumbNailer()->setFile($base . "Maxine" . DS . "gallery" . DS . $entry);
             $this->getThumbNailer()->processImage();
             print "<span title=\"image uploaded: " . $entry . "\">|</span>" . PHP_EOL;
             ## remove the file
             if (file_exists($this->getLocation() . $_POST["directory"] . DS . $entry) === true) {
                 unlink($this->getLocation() . $_POST["directory"] . DS . $entry);
             }
         }
         $dh->close();
         rmdir($this->getLocation() . $_POST["directory"] . DS);
         ## remove the directory
         echo "<a href=\"http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"] . "\">Import More...</a>" . PHP_EOL;
         echo "</p>" . PHP_EOL;
     } else {
         echo "<form method=\"POST\">" . PHP_EOL;
         $dh = dir($this->getLocation());
         $i = 0;
         while (($entry = $dh->read()) !== false) {
             echo "<div class=\"column\" style=\"min-height:5px;\">" . PHP_EOL;
             if (in_array($entry, array(".", ".."))) {
                 continue;
             }
             echo "<input type=\"radio\" name=\"directory\" id=\"" . $entry . "\" value=\"" . $entry . "\" />" . PHP_EOL;
             echo "<label for=\"" . $entry . "\">" . $entry . "</label><br />" . PHP_EOL;
             echo "</div>" . PHP_EOL;
             $i++;
             if ($i > 2) {
                 echo "<br class=\"clear\" />" . PHP_EOL;
                 $i = 0;
             }
         }
         echo "<br class=\"clear\" />" . PHP_EOL;
         $dh->close();
         echo "<input type=\"submit\" value=\"Process\" />" . PHP_EOL;
         echo "</form>" . PHP_EOL;
     }
 }
Example #24
0
 public function __construct()
 {
     parent::__construct('SchbasLending');
 }
Example #25
0
/** displayUserProfile($profile)
 * @param array $profile which profile are we displaying?
 */
function displayUserProfile($profile)
{
    $departments = new TableManager("m3_departments");
    $departments->setCustomIndex("id");
    $alldepts = $departments->selectMultiple();
    if ((!isset($profile["department"]) || !$profile["department"]) && $profile["department_id"]) {
        $profile["department"] = $alldepts[$profile["department_id"]]["name"];
    }
    echo "<div class=\"userProfile\">" . PHP_EOL;
    if ($profile["staffno"] && $profile["location"] && date("Y-m-d", strtotime($profile["createDate"])) != "2011-02-01" && $profile["createDate"] > date("Y-m-d H:i:s", strtotime("-2 weeks"))) {
        echo "<img alt=\"New Staff Member\" src=\"" . BASE . "images/new/profile-new.png\" style=\"border:none;height:37px;left:5px;position:absolute;top:4px;width:38px;z-index:1;\" />";
    }
    ## Image
    $staffno = $profile["staffno"];
    if (strlen($staffno) < 4) {
        $staffno = str_pad($staffno, 4, "0", STR_PAD_LEFT);
    }
    if (file_exists(BASE . "images" . DS . "profiles" . DS . $staffno . ".jpg")) {
        $size = getimagesize(BASE . "images" . DS . "profiles" . DS . $staffno . ".jpg");
        echo "<img alt=\"" . $profile["firstname"] . " " . $profile["lastname"] . "\" src=\"" . BASE . "images" . DS . "profiles" . DS . $staffno . ".jpg\" style=\"height:" . $size[1] . "px;width:" . $size[0] . "px;z-index:0;\" />" . PHP_EOL;
    } else {
        $size = getimagesize(BASE . "images" . DS . "profiles" . DS . "0.jpg");
        echo "<img alt=\"" . $profile["firstname"] . " " . $profile["lastname"] . "\" src=\"" . BASE . "images" . DS . "profiles" . DS . "0.jpg\" style=\"height:" . $size[1] . "px;width:" . $size[0] . "px;z-index:0;\" />" . PHP_EOL;
    }
    $abbrs = (array) array("Human Resources" => "H.R", "Information Technology" => "I.T", "Isando Operations" => "Isando Ops", "Operations Distribution" => "Ops Distribution", "Operations Africa" => "Ops Africa", "Operations Freight" => "Ops Freight");
    ## Data
    echo "<div class=\"userProfileBasicData\">" . PHP_EOL;
    echo "<h3>" . $profile["firstname"] . " " . $profile["lastname"] . "</h3>" . PHP_EOL;
    echo "<h4>" . shortenWord(urldecode($profile["jobtitle"]), 23) . "</h5><br />" . PHP_EOL;
    echo "<label style=\"font-weight:bold;margin-bottom:8px;margin-right:5px;width:80px;\">Department:</label><label style=\"margin-bottom:2px;width:98px;\">" . (isset($profile["department"]) ? in_array($profile["department"], array_keys($abbrs)) ? $abbrs[$profile["department"]] : $profile["department"] : "") . "</label><br class=\"clear\" />" . PHP_EOL;
    echo "<label style=\"font-weight:bold;margin-bottom:8px;margin-right:5px;width:80px;\">Location:</label><label style=\"margin-bottom:2px;width:98px;\">" . $profile["location"] . "</label><br class=\"clear\" />" . PHP_EOL;
    echo "<label style=\"font-weight:bold;margin-bottom:8px;margin-right:5px;width:80px;\">Staff No.:</label><label style=\"margin-bottom:2px;width:98px;\">" . $profile["staffno"] . "</label><br class=\"clear\" />" . PHP_EOL;
    echo "</div>" . PHP_EOL;
    ## More|Less
    echo "<div class=\"userProfileMoreLess\" id=\"profile_" . $profile["id"] . "\" onclick=\"events.cancelBubble(event);profiles.show(this);\">more</div>" . PHP_EOL;
    ## Collapsible div
    echo "<div class=\"userProfileMoreInformation\" id=\"profileData[" . $profile["id"] . "]\" style=\"display:none;\">" . PHP_EOL;
    echo "<div>" . PHP_EOL;
    echo "<label style=\"font-weight:bold;margin-bottom:2px;width:75px;\">Birthday:</label><label style=\"margin-bottom:2px;width:205px;\">" . date("d F", $profile["birthday"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    if ($profile["interests"]) {
        echo "<label style=\"font-weight:bold;width:80px;\">Interests:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["interests"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    }
    if ($profile["family"]) {
        echo "<label style=\"font-weight:bold;width:80px;\">Family:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["family"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    }
    if ($profile["aspirations"]) {
        echo "<label style=\"font-weight:bold;width:80px;\">Aspirations:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["aspirations"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    }
    if ($profile["goals"]) {
        echo "<label style=\"font-weight:bold;width:80px;\">Goal:</label><br /><label style=\"margin-bottom:5px;width:100%;\">" . urldecode($profile["goals"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    }
    if ($profile["quote"]) {
        echo "<label style=\"font-weight:bold;width:80px;\">Quote:</label><br /><label style=\"width:100%;\">" . urldecode($profile["quote"]) . "</label><br class=\"clear\" />" . PHP_EOL;
    }
    echo "</div>" . PHP_EOL;
    echo "</div>" . PHP_EOL;
    echo "</div>" . PHP_EOL;
}
Example #26
0
 function __construct()
 {
     parent::__construct('SystemGlobalSettings');
 }
 /** fleetTruckLinkImporter::__construct()
  * Class constructor
  */
 public function __construct()
 {
     $realPath = realpath(dirname(__FILE__));
     $maxine = substr($realPath, 0, strrpos($realPath, DIRECTORY_SEPARATOR));
     $rootaccess = substr($maxine, 0, strrpos($maxine, DIRECTORY_SEPARATOR) + 1);
     defined("BASE") || define("BASE", $rootaccess);
     include_once BASE . "basefunctions/baseapis/TableManager.php";
     include_once BASE . "basefunctions/baseapis/FileParser/FileParser.php";
     $manager = new TableManager("fleet_truck_count");
     //: Do a test to see if table includes subbie_trucks field
     $fields = $manager->describeTable();
     if (in_array('subbie_count', array_keys($fields)) === FALSE) {
         $sql = (string) "ALTER TABLE `fleet_truck_count` ADD COLUMN `subbie_count` INT NOT NULL DEFAULT 0;";
         if ($manager->runSql($sql) === FALSE) {
             print "Altering table failed" . PHP_EOL;
             return FALSE;
         }
     }
     //: End
     $subbietrucksurl = "https://login.max.bwtsgroup.com/api_request/Report/export?report=153&responseFormat=csv";
     // Max
     $apiurl = "https://login.max.bwtsgroup.com/api_request/Report/export?report=145&responseFormat=csv";
     // Max
     $t24apiurl = "https://t24.max.bwtsgroup.com/api_request/Report/export?report=73&responseFormat=csv";
     // T24
     // $apiurl	= "http://max.mobilize.biz/m4/2/api_request/Report/export?report=141&responseFormat=csv"; // Test
     //: Get the list of subbie trucks
     $fileParser = new FileParser($subbietrucksurl);
     $fileParser->setCurlFile("subbie_trucks.csv");
     $data = $fileParser->parseFile();
     $subbieTrucks = (array) array();
     foreach ($data as $val) {
         if (array_key_exists("Trucks", $val) === FALSE) {
             continue;
         }
         $trucks = preg_split("/\\,/", $val["Trucks"]);
         if (is_array($trucks) === FALSE) {
             continue;
         }
         foreach ($trucks as $trucklist) {
             $subbieTrucks[] = $trucklist;
         }
     }
     //print_r($subbieTrucks);
     unset($data);
     //return FALSE;
     //: End
     $fleetDayHandler = new fleetDayHandler();
     $required_fleets = $fleetDayHandler->getIncomeFleets();
     $rows = (array) array();
     foreach ($required_fleets as $val) {
         if (array_key_exists('fleets', $val)) {
             $count = (int) 0;
             $subbie_count = (int) 0;
             foreach ($val['fleets'] as $subfleets) {
                 $manager->setWhere($manager->quoteString('`fleet_id`=?', $subfleets[0]));
                 $record = $manager->selectSingle();
                 $count += (int) $record['count'];
                 $subbie_count += (int) $record['subbie_count'];
             }
             $rows[] = (array) array('fleet_id' => $val['id'], 'count' => isset($count) && $count ? $count : 0, 'subbie_count' => isset($subbie_count) && $subbie_count ? $subbie_count : 0);
         } else {
             $url = $apiurl . "&Fleet=" . $val["maxid"] . "&Start%20Date=" . date("Y-m-d") . "&Stop%20Date=" . date('Y-m-d', strtotime('+1 day'));
             if (array_key_exists('t24', $val)) {
                 $url = $t24apiurl . "&Fleet=" . $val["maxid"] . "&Start%20Date=" . date("Y-m-d") . "&Stop%20Date=" . date('Y-m-d', strtotime('+1 day'));
             }
             print_r('url: ' . $url . PHP_EOL);
             $fileParser = new FileParser($url);
             $fileParser->setCurlFile("fleet_truck_count_" . $val["id"] . ".csv");
             $data = $fileParser->parseFile();
             // print_r($data);
             /*if ($fleetId == 75) { //: confirm a fleet is correct
             		print("<pre>");
             		print_r($data);
             		print("</pre>");
             		}*/
             $sub_cnt = (int) 0;
             foreach ($data as $row) {
                 if (in_array($row['Truck'], $subbieTrucks)) {
                     $sub_cnt++;
                 }
             }
             //print($sub_cnt.PHP_EOL);
             $record = (array) array('fleet_id' => $val['id'], 'count' => count($data), 'subbie_count' => $sub_cnt);
             if (array_key_exists('t24', $val)) {
                 $record['t24'] = (int) 1;
             }
             $rows[] = $record;
         }
     }
     //: Loop through and update/insert records
     foreach ($rows as $row) {
         $where = (string) $manager->quoteString('`fleet_id`=?', $row['fleet_id']);
         if (array_key_exists('t24', $row) && $row['t24'] === 1) {
             $where .= $manager->quoteString(' AND `t24`=?', $row['t24']);
         }
         $manager->setWhere($where);
         $record = $manager->selectSingle();
         if ($record) {
             print_r($record);
             print_r($row);
             $nDifference = (double) $row['count'] == 0 ? 100 : ($record['count'] - $row['count']) / $row['count'] * 100;
             print_r('diff:  ' . $nDifference . PHP_EOL);
             if ($nDifference > 50 || $nDifference < -50) {
                 continue;
             }
             $manager->setWhere($manager->quoteString('`id`=?', $record['id']));
             $manager->update($row);
         } else {
             $manager->insert($row);
         }
     }
 }
Example #28
0
 function getInvIDByBarcode($barcode)
 {
     require_once PATH_ACCESS . '/DBConnect.php';
     $bookmanager = new BookManager();
     $barcode = str_replace("-", "/", $barcode);
     // replace - with /
     $barcode = preg_replace("/\\/([0-9])/", "/ \$1", $barcode);
     //add space after / when it's missing
     $barcode = str_replace("  ", " ", $barcode);
     // remove two empty spaces
     $bookData = $bookmanager->getBookDataByBarcode($barcode);
     try {
         $barcode_exploded = explode(' ', $barcode);
     } catch (Exception $e) {
     }
     if (isset($bookData["id"]) && isset($barcode_exploded[5])) {
         $query = sql_prev_inj(sprintf('book_id = %s AND year_of_purchase = %s AND exemplar = %s', $bookData["id"], $barcode_exploded[1], $barcode_exploded[5]));
         $result = parent::searchEntry($query);
         return $result['id'];
     }
 }
Example #29
0
 /**
  * returns all orders of a meal at givne date
  * @param numberic_string $ID the ID of the meal whose orders to return
  * @param date the date
  * @return array of orders
  */
 function getAllOrdersOfMealAtDate($ID, $date)
 {
     return parent::getTableData(sprintf('MID = "%s" AND date = "' . $date . '" ORDER BY date', $ID, $date));
 }
Example #30
0
 /** Scaffold_Forms_User_profiles::setHtml($html = null)
  * @param string $html HTML form definition
  */
 public function setHtml($html = NULL)
 {
     ## Preparation
     $record = $this->getRecord();
     if (is_object("TableManager") === false) {
         include_once BASE . DIRECTORY_SEPARATOR . "basefunctions" . DIRECTORY_SEPARATOR . "baseapis" . DIRECTORY_SEPARATOR . "TableManager.php";
     }
     $tableManager = new TableManager("m3_departments");
     $departments = $tableManager->selectMultiple();
     $sql = (string) "SELECT * FROM `themes` WHERE (ISNULL(`deleted`) OR `deleted`=0)";
     $themes = $tableManager->runSql($sql);
     $users = new TableManager("users");
     $metaData = $users->getMetaData();
     if ($record) {
         $users->setChildRecords(true);
         $users->setChildTables(array(0 => array("rights_users" => "rights_users", "where" => "`rights_users`.`userid`=?")));
         $users->setWhere($users->quoteString("`users`.`user_profiles_id`=?", (int) $record["id"]));
         $user = $users->selectSingle();
     }
     $sql = (string) "SELECT * FROM `rights_groups` WHERE 1=1;";
     $rights_groups = $users->runSql($sql);
     $locations = (array) array(0 => array("name" => "Head Office"), 1 => array("name" => "Durban"), 2 => array("name" => "Empangeni"), 3 => array("name" => "East London"), 4 => array("name" => "Kokstad"), 5 => array("name" => "Pietermaritzburg"), 6 => array("name" => "Newcastle"), 7 => array("name" => "Vanderbijl Park"), 8 => array("name" => "Isando"), 9 => array("name" => "Germiston"), 10 => array("name" => "Cape Town"), 11 => array("name" => "Wilmar Depot"), 12 => array("name" => "Sasolburg"), 13 => array("name" => "Boksburg"), 14 => array("name" => "Port Elizabeth"), 15 => array("name" => "Delmas"), 16 => array("name" => "Slurry"), 17 => array("name" => "Hercules"), 18 => array("name" => "Heriotdale"));
     ## End
     if (is_string($html) === FALSE) {
         $html = NULL;
     }
     if ($html === NULL) {
         $html = (string) "<style type=\"text/css\">";
         $html .= "#buttons{padding:5px 30px;text-align:right;}";
         $html .= "#content{padding:10px 15px;text-align:left;}";
         $html .= "#tabs{background-color:#ebf0ea;}";
         $html .= "#tabImages{margin:0px auto;}";
         $html .= "#userProfile{background-color:#bccdba;font:13px/1.22 Arial,Helvetica,sans-serif;margin:0px;padding:0px;width:100%;}";
         $html .= ".lbl{color:#000;margin:2px 0px 19px;padding:0px;width:auto;}";
         $html .= ".lblcb{color:#000;margin-bottom:15px;margin-top:0px;padding:0px;width:auto;}";
         $html .= ".pc{display:inline-block;float:left;margin-right:15px;text-align:left;width:auto;}";
         $html .= ".tablImages{cursor:pointer;height:39px;padding:10px 15px;width:44px;}";
         $html .= ".tablImages:first-child{background-color:#FFF;}";
         $html .= "input,select,textarea{background-color:#FFF;border:1px solid #999;margin:0px 0px 15px;padding:0px;width:100%;}";
         $html .= "input[type=checkbox],input[type=radio]{width:auto;}";
         $html .= "textarea{height:54px;}";
         $html .= "</style>" . PHP_EOL;
         $html .= "<form enctype=\"multipart/form-data\" id=\"userProfile\" method=\"POST\">";
         if (isset($user) && isset($user["personid"])) {
             $html .= "<input name=\"personid\" type=\"hidden\" value=\"" . $user["personid"] . "\" />";
         }
         $html .= "<div id=\"tabs\"><span id=\"tabImages\">";
         ## Mouse Events
         $mouse_events = (string) "onclick=\"up.mouse(this, event);\" onmouseout=\"up.mouse(this, event);\" onmouseover=\"up.mouse(this, event);\"";
         $html .= "<img alt=\"profile\" class=\"tablImages\" " . $mouse_events . " src=\"" . BASE . "images/new/icon-profile.png\" />";
         $html .= "<img alt=\"communication\" class=\"tablImages\" " . $mouse_events . " src=\"" . BASE . "images/new/icon-communication.png\" />";
         $html .= "<img alt=\"login\" class=\"tablImages\" " . $mouse_events . " src=\"" . BASE . "images/new/icon-login.png\" />";
         if (isset($_SESSION["isit"]) && $_SESSION["isit"]) {
             $html .= "<img alt=\"flags\" class=\"tablImages\" " . $mouse_events . " src=\"" . BASE . "images/new/icon-flags.png\" />";
             $html .= "<img alt=\"accessgroups\" class=\"tablImages\" " . $mouse_events . " src=\"" . BASE . "images/new/icon-accessgroups.png\" />";
         }
         $html .= "</span></div>";
         $html .= "<div id=\"content\">";
         ## Profile
         $html .= "<div id=\"profile\">";
         $html .= "<span class=\"pc\">";
         ## labels
         $html .= "<label class=\"lbl\" for=\"staffno\">Staff Number</label><br />";
         $html .= "<label class=\"lbl\" for=\"firstname\">First name</label><br />";
         $html .= "<label class=\"lbl\" for=\"lastname\">Last name</label><br />";
         $html .= "<label class=\"lbl\" for=\"jobtitle\">Job Title</label><br />";
         $html .= "<label class=\"lbl\" for=\"department_id\" style=\"margin-bottom:21px;\">Department</label><br />";
         $html .= "<label class=\"lbl\" for=\"location\">Location</label><br />";
         $html .= "<label class=\"lbl\" for=\"day\" style=\"margin-bottom:21px;\">Birthday</label><br />";
         if (isset($_SESSION["isit"]) && $_SESSION["isit"]) {
             $html .= "<label class=\"lbl\" for=\"image_file\">Image</label><br />" . PHP_EOL;
         }
         $html .= "<label class=\"lbl\" for=\"fortune\" title=\"Would you like a fortune cookie to be displayed on each page?\">Fortune</label><br />";
         $html .= "<label class=\"lbl\" for=\"theme_id\">Theme</label><br />";
         $html .= "</span>";
         $html .= "<span class=\"pc\" style=\"margin-right:30px;text-align:left;width:32%;\">";
         ## inputs
         $html .= "<input id=\"staffno\" name=\"staffno\" " . (isset($record) && isset($record["staffno"]) ? "readonly=\"readonly\" " : "") . " type=\"text\" value=\"" . (isset($record) && isset($record["staffno"]) ? $record["staffno"] : "") . "\">";
         $html .= "<input id=\"firstname\" name=\"firstname\" type=\"text\" value=\"" . (isset($record) && isset($record["firstname"]) ? $record["firstname"] : "") . "\">";
         $html .= "<input id=\"lastname\" name=\"lastname\" type=\"text\" value=\"" . (isset($record) && isset($record["lastname"]) ? $record["lastname"] : "") . "\">";
         $html .= "<input id=\"jobtitle\" name=\"jobtitle\" type=\"text\" value=\"" . (isset($record) && isset($record["jobtitle"]) ? $record["jobtitle"] : "") . "\" />";
         $html .= "<select id=\"department_id\" name=\"department_id\">";
         $html .= "<option value=\"0\">Please select...</options>";
         foreach ($departments as $dept) {
             $html .= "<option value=\"" . $dept["id"] . "\"" . (isset($record) && isset($record["department_id"]) && $record["department_id"] == $dept["id"] ? " selected=\"selected\"" : "") . ">" . $dept["name"] . "</option>";
         }
         $html .= "</select>";
         $html .= "<select id=\"location\" name=\"location\">";
         foreach ($locations as $location) {
             $html .= "<option " . (isset($record) && isset($record["location"]) && $record["location"] == $location["name"] ? "selected=\"selected\" " : "") . "value=\"" . $location["name"] . "\">" . $location["name"] . "</option>";
         }
         $html .= "</select>";
         $html .= "<select id=\"day\" name=\"day\" style=\"float:left;margin-bottom:15px;margin-right:15px;width:60px;\">";
         $html .= "<option value=\"0\">Day</option>";
         for ($i = 1; $i < 32; $i++) {
             $html .= "<option " . (isset($record) && isset($record["birthday"]) && date("d", $record["birthday"]) == $i ? "selected=\"selected\" " : "") . "value=\"" . (strlen($i) == 1 ? "0" . $i : $i) . "\">" . (strlen($i) == 1 ? "0" . $i : $i) . "</option>";
         }
         $html .= "</select>";
         $html .= "<select id=\"month\" name=\"month\" style=\"float:left;width:120px;\">";
         $html .= "<option value=\"0\">Month</option>";
         for ($i = 1; $i < 13; $i++) {
             $html .= "<option " . (isset($record) && isset($record["birthday"]) && date("F", $record["birthday"]) == date("F", mktime(0, 0, 0, $i, 1, 2000)) ? "selected=\"selected\" " : "") . "value=\"" . date("m", mktime(0, 0, 0, $i, 1, 2000)) . "\">" . date("F", mktime(0, 0, 0, $i, 1, 2000)) . "</option>";
         }
         $html .= "</select>";
         if (isset($_SESSION["isit"]) && $_SESSION["isit"]) {
             $html .= "<input type=\"file\" id=\"image_file\" name=\"image\" size=\"15\" />";
         }
         $html .= "<input" . (isset($record) && isset($record["fortune"]) && $record["fortune"] ? " checked=\"checked\"" : "") . " id=\"fortune\" name=\"fortune\" type=\"checkbox\" value=\"1\" /><br class=\"clear\" />";
         $html .= "<input id=\"theme_id\" name=\"theme_id\" type=\"hidden\" value=\"" . (isset($record) && isset($record["theme_id"]) ? $record["theme_id"] : "") . "\"  />";
         $i = (int) 0;
         $html .= "<div>";
         foreach (is_array($themes) ? $themes : array() as $theme) {
             $html .= "<img alt=\"theme\" onclick=\"up.resetBorders(this);document.getElementById('theme_id').value='" . $theme["id"] . "';\" src=\"" . BASE . "images/new/themes/" . $theme["background-image"] . "\" style=\"border:1px solid #" . (isset($record) && isset($record["theme_id"]) && $record["theme_id"] === $theme["id"] ? "F00" : "000") . ";cursor:pointer;height:30px;margin:5px;width:30px;\" />";
             $i++;
             if ($i === 3) {
                 $i = 0;
                 $html .= "<br class=\"clear\" />";
             }
         }
         $html .= "</div><br class=\"clear\" >";
         $html .= "</span>";
         $html .= "<span class=\"pc\">";
         ## labels
         $html .= "<label class=\"lbl\" for=\"family\" style=\"margin-bottom:56px;\">Family</label><br class=\"clear\" />";
         $html .= "<label class=\"lbl\" for=\"goals\" style=\"margin-bottom:56px;\">Goals</label><br class=\"clear\" />";
         $html .= "<label class=\"lbl\" for=\"interests\" style=\"margin-bottom:56px;\">Interests</label><br class=\"clear\" />";
         $html .= "<label class=\"lbl\" for=\"aspirations\" style=\"margin-bottom:56px;\">Aspirations</label><br class=\"clear\" />";
         $html .= "<label class=\"lbl\" for=\"quote\" style=\"margin-bottom:56px;\">Quote</label><br class=\"clear\" />";
         $html .= "</span>";
         $html .= "<span class=\"pc\" style=\"width:32%;\">";
         ## inputs
         $html .= "<textarea id=\"family\" name=\"family\">" . ($record ? $record["family"] : "") . "</textarea><br class=\"clear\" />";
         $html .= "<textarea id=\"goals\" name=\"goals\">" . ($record ? $record["goals"] : "") . "</textarea><br />";
         $html .= "<textarea id=\"interests\" name=\"interests\">" . ($record ? $record["interests"] : "") . "</textarea><br />";
         $html .= "<textarea id=\"aspirations\" name=\"aspirations\">" . ($record ? $record["aspirations"] : "") . "</textarea><br />";
         $html .= "<textarea id=\"quote\" name=\"quote\">" . ($record ? $record["quote"] : "") . "</textarea><br />";
         $html .= "</span>";
         $html .= "<br class=\"clear\" /></div>";
         ## Communication
         $html .= "<div id=\"communication\" style=\"display:none;\">";
         $html .= "<span class=\"pc\">";
         ## labels
         $html .= "<label class=\"lbl\" for=\"extension\">Office extension</label><br />";
         $html .= "<label class=\"lbl\" for=\"cell\">Cellphone</label>";
         $html .= "</span>";
         $html .= "<span class=\"pc\" style=\"margin-right:30px;width:30%;\">";
         ## inputs
         $html .= "<input id=\"extension\" name=\"extension\" type=\"text\" value=\"" . (isset($user) && isset($user["extension"]) ? $user["extension"] : "") . "\" /><br style=\"clear:both;\" />";
         $html .= "<input id=\"cell\" name=\"cell\" type=\"text\" value=\"" . (isset($user) && isset($user["cell"]) ? $user["cell"] : "") . "\" /><br />";
         $html .= "</span>";
         $html .= "<span class=\"pc\">";
         ## labels
         $html .= "<label class=\"lbl\" for=\"email\">Email</label>";
         $html .= "</span>";
         $html .= "<span class=\"pc\" style=\"width:37.4%;\">";
         ## inputs
         $html .= "<input id=\"email\" name=\"email\" type=\"email\" value=\"" . $user["email"] . "\" /><br />";
         $html .= "</span>";
         $html .= "<br class=\"clear\" /></div>";
         ## Login
         $html .= "<div id=\"login\" style=\"display:none;\">";
         $html .= "<span class=\"pc\">";
         ## labels
         $html .= "<label class=\"lbl\" for=\"username\">Username</label>";
         $html .= "</span>";
         $html .= "<span class=\"pc\" style=\"margin-right:30px;width:32%;\">";
         ## inputs
         $html .= "<input id=\"username\" name=\"username\" type=\"text\" value=\"" . (isset($user) && isset($user["username"]) ? $user["username"] : "") . "\" />";
         $html .= "</span>";
         $html .= "<span class=\"pc\">";
         ## labels
         $html .= "<label class=\"lbl\" for=\"password\">Password</label><br />";
         $html .= "<label class=\"lbl\" for=\"con_pass\">Confirm password</label>";
         $html .= "</span>";
         $html .= "<span class=\"pc\" style=\"width:29%;\">";
         ## inputs
         $html .= "<input id=\"password\" name=\"password\" type=\"password\" /><br />";
         $html .= "<input id=\"con_pass\" onblur=\"formManipulators.checkPasswordIdentical('password', 'con_pass');\" type=\"password\" />";
         $html .= "</span>";
         $html .= "<br class=\"clear\" /></div>";
         if (isset($_SESSION["isit"]) && $_SESSION["isit"]) {
             ## Flags
             $cols = (array) array();
             $i = (int) 0;
             foreach ($metaData as $col => $data) {
                 if ($col == "isadmin") {
                     continue;
                 }
                 if (in_array($data["Type"], array("int(1)", "tinyint(1)"))) {
                     $cols[$i][$col] = $data;
                     $i++;
                     if ($i === 3) {
                         $i = 0;
                     }
                 }
             }
             $html .= "<div id=\"flags\" style=\"display:none;\">";
             $html .= "<span class=\"pc\">";
             ## inputs
             foreach (is_array($cols[0]) ? $cols[0] : array() as $col => $data) {
                 $html .= "<input" . (isset($user) && isset($user[$col]) && $user[$col] ? " checked=\"checked\"" : "") . " id=\"" . $col . "\" name=\"" . $col . "\" style=\"float:left;margin-bottom:15px;\" type=\"checkbox\" value=\"1\" /><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<span class=\"pc\" style=\"width:25%;\">";
             ## labels
             foreach (is_array($cols[0]) ? $cols[0] : array() as $col => $data) {
                 $html .= "<label class=\"lblcb\" for=\"" . $col . "\">" . $col . "</label><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<span class=\"pc\">";
             ## inputs
             foreach (is_array($cols[1]) ? $cols[1] : array() as $col => $data) {
                 $html .= "<input" . (isset($user) && isset($user[$col]) && $user[$col] ? " checked=\"checked\"" : "") . " id=\"" . $col . "\" name=\"" . $col . "\" style=\"float:left;margin-bottom:15px;\" type=\"checkbox\" value=\"1\" /><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<span class=\"pc\" style=\"width:25%;\">";
             ## labels
             foreach (is_array($cols[1]) ? $cols[1] : array() as $col => $data) {
                 $html .= "<label class=\"lblcb\" for=\"" . $col . "\">" . $col . "</label><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<span class=\"pc\">";
             ## inputs
             foreach (is_array($cols[2]) ? $cols[2] : array() as $col => $data) {
                 $html .= "<input" . (isset($user) && isset($user[$col]) && $user[$col] ? " checked=\"checked\"" : "") . " id=\"" . $col . "\" name=\"" . $col . "\" style=\"float:left;margin-bottom:15px;\" type=\"checkbox\" value=\"1\" /><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<span class=\"pc\" style=\"width:25%;\">";
             ## labels
             foreach (is_array($cols[2]) ? $cols[2] : array() as $col => $data) {
                 $html .= "<label class=\"lblcb\" for=\"" . $col . "\">" . $col . "</label><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<br class=\"clear\" /></div>";
             ## Access groups
             $cols = (array) array();
             $i = (int) 0;
             foreach ($rights_groups as $grp) {
                 $cols[$i][] = $grp;
                 $i++;
                 if ($i === 3) {
                     $i = 0;
                 }
             }
             $html .= "<div id=\"accessgroups\" style=\"display:none;\">";
             $html .= "<span class=\"pc\">";
             ## inputs
             foreach (is_array($cols[0]) ? $cols[0] : array() as $key => $data) {
                 $checked = (bool) false;
                 if (isset($user["children"]["rights_users"]) && is_array($user["children"]["rights_users"])) {
                     foreach ($user["children"]["rights_users"] as $right) {
                         if ($right['groupid'] == $data["id"]) {
                             $checked = true;
                             break;
                         }
                     }
                 }
                 $html .= "<input" . ($checked ? " checked=\"checked\"" : "") . " id=\"" . $data["id"] . "\" name=\"group[" . $data["id"] . "]\" style=\"float:left;margin-bottom:15px;\" type=\"checkbox\" value=\"" . $data["id"] . "\" /><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<span class=\"pc\" style=\"width:25%;\">";
             ## labels
             foreach (is_array($cols[0]) ? $cols[0] : array() as $key => $data) {
                 $html .= "<label class=\"lblcb\" for=\"" . $data["id"] . "\" title=\"" . $data["description"] . "\">" . $data["name"] . "</label><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<span class=\"pc\">";
             ## inputs
             foreach (is_array($cols[1]) ? $cols[1] : array() as $key => $data) {
                 $checked = (bool) false;
                 if (isset($user["children"]["rights_users"]) && is_array($user["children"]["rights_users"])) {
                     foreach ($user["children"]["rights_users"] as $right) {
                         if ($right['groupid'] == $data["id"]) {
                             $checked = true;
                             break;
                         }
                     }
                 }
                 $html .= "<input" . ($checked ? " checked=\"checked\"" : "") . " id=\"" . $data["id"] . "\" name=\"group[" . $data["id"] . "]\" style=\"float:left;margin-bottom:15px;\" type=\"checkbox\" value=\"" . $data["id"] . "\" /><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<span class=\"pc\" style=\"width:25%;\">";
             ## labels
             foreach (is_array($cols[1]) ? $cols[1] : array() as $key => $data) {
                 $html .= "<label class=\"lblcb\" for=\"" . $data["id"] . "\" title=\"" . $data["description"] . "\">" . $data["name"] . "</label><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<span class=\"pc\">";
             ## inputs
             foreach (is_array($cols[2]) ? $cols[2] : array() as $key => $data) {
                 $checked = (bool) false;
                 if (isset($user["children"]["rights_users"]) && is_array($user["children"]["rights_users"])) {
                     foreach ($user["children"]["rights_users"] as $right) {
                         if ($right['groupid'] == $data["id"]) {
                             $checked = true;
                             break;
                         }
                     }
                 }
                 $html .= "<input" . ($checked ? " checked=\"checked\"" : "") . " id=\"" . $data["id"] . "\" name=\"group[" . $data["id"] . "]\" style=\"float:left;margin-bottom:15px;\" type=\"checkbox\" value=\"" . $data["id"] . "\" /><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<span class=\"pc\" style=\"width:25%;\">";
             ## labels
             foreach (is_array($cols[2]) ? $cols[2] : array() as $key => $data) {
                 $html .= "<label class=\"lblcb\" for=\"" . $data["id"] . "\" title=\"" . $data["description"] . "\">" . $data["name"] . "</label><br class=\"clear\" />";
             }
             $html .= "</span>";
             $html .= "<br class=\"clear\" /></div>";
         }
         $html .= "<br class=\"clear\" /></div>";
         $html .= "<div id=\"buttons\">";
         $html .= "<span class=\"button\" onclick=\"document.getElementById('userProfile').submit();\" style=\"height:26px;padding-top:8px;width:114px;\">Save</span>";
         $html .= "<span class=\"button\" onclick=\"document.location='/';\" style=\"height:26px;padding-top:8px;width:114px;\">Cancel</span>";
         $html .= "</div>";
         $html .= "</form>" . PHP_EOL;
         $html .= "<script type=\"text/javascript\">";
         $html .= "var up={};";
         $html .= "up.mouse = function(e, ev) {";
         $html .= "var i,p1=e.parentNode,p2=document.getElementById('content');";
         $html .= "if (!ev) {var ev = window.event;} if (!ev) {return false;}";
         $html .= "switch (ev.type) {";
         $html .= "case 'click': ";
         $html .= "for (i=0;i<p1.childNodes.length;i++){p1.childNodes[i].style.backgroundColor='inherit';if (p1.childNodes[i].getAttribute('alt') == e.getAttribute('alt')) {e.setAttribute('obg', '#FFF');e.style.backgroundColor='#FFF';}} ";
         $html .= "for (i=0;i<p2.childNodes.length;i++) {p2.childNodes[i].style.display='none';}";
         $html .= "document.getElementById(e.getAttribute('alt')).style.display='';";
         $html .= "break;";
         $html .= "case 'mouseout': e.style.backgroundColor=e.getAttribute('obg'); break;";
         $html .= "case 'mouseover': e.setAttribute('obg', e.style.backgroundColor);e.style.backgroundColor='#FFF'; break;";
         $html .= "}";
         $html .= "};";
         $html .= "up.resetBorders = function(e){";
         $html .= "var i,p=e.parentNode;";
         $html .= "for(i=0;i<p.childNodes.length;i++){p.childNodes[i].style.borderColor='#000';}";
         $html .= "e.style.borderColor='#F00';";
         $html .= "};";
         $html .= "</script>" . PHP_EOL;
         //$html .= "";
     }
     $this->_html = $html;
 }