Example #1
0
function get_active_theme()
{
    $theme_name = "";
    // Get a name of the active theme.
    $sql = "SELECT t.theme_name FROM theme t JOIN settings s WHERE t.themeid = s.themeid";
    $q = new Query();
    $q->connect();
    $rows = $q->exec($sql);
    if (count($rows) > 0) {
        $theme_name = $rows[0]["theme_name"];
    }
    $q->close();
    // Check theme directory existence.
    $theme = "../themes/" . $theme_name;
    if (file_exists($theme . "/style.css")) {
        return $theme_name;
    } else {
        return "";
    }
}
 function systemSetup()
 {
     try {
         /*use the DbQuery's static 'connect' method to connect to the database*/
         Query::connect();
         if (constant('DEVELOPMENT')) {
             $query = SimpleQuery::create('SHOW TABLES FROM ' . constant('DB_NAME') . ' LIKE \'%_access\'');
             if (!$query->numRows()) {
                 Query::importFile('packages/pilot/pilot.sql');
             }
         }
     } catch (DbNotFoundException $exc) {
         if (constant('DB_NAME')) {
             if (mysql_query('CREATE DATABASE ' . constant('DB_NAME'))) {
                 Query::connect();
                 Query::importFile('packages/pilot/pilot.sql');
             } else {
                 throw new DbConnectException('I don\'t have permission to create your database for you, please create the database ' . constant('DB_NAME') . ' manually and then import the file packages/pilot/pilot.sql into it');
             }
         }
     }
 }
 */
require_once "../functions/inputFuncs.php";
require_once '../classes/DmQuery.php';
$dmQ = new DmQuery();
$dmQ->connect();
$mbrClassifyDm = $dmQ->getAssoc('mbr_classify_dm');
$mbrStatusDm = array("y" => $loc->getText("mbrActive"), "n" => $loc->getText("mbrInactive"));
$customFields = $dmQ->getAssoc('member_fields_dm');
$dmQ->close();
// Get & show the latest BarcodeNumber.
require_once "../shared/common.php";
require_once "../classes/Query.php";
$barcode = "0";
$sql = "SELECT MAX(barcode_nmbr) AS bn FROM member";
$q = new Query();
$q->connect();
$rows = $q->exec($sql);
if (count($rows) > 0) {
    $barcode = $rows[0]["bn"];
}
$q->close();
$barcode_help = $loc->getText("mbrLatestBarcode") . ": " . $barcode . " <br />";
$barcode_help .= '<input type="checkbox" id="chk_auto_barcode" name="chk_auto_barcode" value="1" /> ' . $loc->getText("mbrAutoBarcode");
$fields = array("mbrFldsClassify" => inputField('select', "classification", $mbr->getClassification(), NULL, $mbrClassifyDm), "mbrFldsStatus" => inputField('select', "status", $mbr->getStatus(), NULL, $mbrStatusDm), "mbrFldsCardNmbr" => inputField('text', "barcodeNmbr", $mbr->getBarcodeNmbr(), NULL, NULL, $barcode_help), "mbrFldsLastName" => inputField('text', "lastName", $mbr->getLastName()), "mbrFldsFirstName" => inputField('text', "firstName", $mbr->getFirstName()), "mbrFldsHomePhone" => inputField('text', "homePhone", $mbr->getHomePhone()), "mbrFldsWorkPhone" => inputField('text', "workPhone", $mbr->getWorkPhone()), "mbrFldsCel" => inputField('text', "cel", $mbr->getCel()), "mbrFldsEmail" => inputField('text', "email", $mbr->getEmail()), "mbrFldsFoto" => inputField('text', "foto", $mbr->getFoto()), "MailingAddress:" => inputField('textarea', "address", $mbr->getAddress()), "mbrFldsPassUser" => inputField('text', "passUser", $mbr->getPassUser()), "mbrFldsBornDt" => inputField('text', "bornDt", $mbr->getBornDt()), "mbrFldsOther" => inputField('textarea', "other", $mbr->getOther()));
foreach ($customFields as $name => $title) {
    $fields[$title . ':'] = inputField('text', 'custom_' . $name, $mbr->getCustom($name));
}
?>

<table class="primary">
  <tr>
 function getCustomFields($mbrid)
 {
     # KLUDGE to make sure we don't clobber the results handle
     # when we're called from fetchmember().
     # FIXME - redo query stuff to avoid this issue
     $q = new Query();
     $q->connect();
     $sql = $q->mkSQL('select * from member_fields where mbrid=%N', $mbrid);
     $rows = $q->exec($sql);
     $fields = array();
     foreach ($rows as $r) {
         $fields[$r['code']] = $r['data'];
     }
     return $fields;
 }