コード例 #1
0
ファイル: class_editor.php プロジェクト: Gimcrack/aimsys
 public function _storeData()
 {
     #setup some variables
     $user_id = $_SESSION['use_id'];
     $this->_isUpd();
     #get fields
     $this->fields = $this->is_update ? dbfn::_getupdatefields($this->table) : dbfn::_getinsertfields($this->table);
     #build query
     $query = $this->is_update ? dbfn::_buildupdate($this->fields, $this->table, $this->prikey) : dbfn::_buildinsert($this->fields, $this->table);
     #get changes to the data
     $this->_getDataChanges();
     #execute query
     $oResult = new db($query);
     $this->rowid = $this->is_update ? $this->rowid : $oResult->insert_id;
     #format output
     $output = $oResult->ret;
     #determine if operation was a success and store in history
     if ($output['msg_class'] == "success") {
         aimsys::_history($query, $this->changes, $this->table, $this->rowid);
         $output['js'] = $this->is_update || req::_('popup') != 0 ? "" : "Tabs.activeTab.new2view('{$this->table}','{$this->rowid}');";
         //additional javascript to run for new records
         $output['rowid'] = $this->rowid;
     }
     return $output;
 }
コード例 #2
0
ファイル: form.php プロジェクト: Gimcrack/aimsys
    case 'frm_gettabs':
        $t = aimsys::_getTabs();
        break;
}
/**  **  **  **  **  **  **  **  **  **
 *   OUTPUT THE RESULTS
 */
switch ($frm_name) {
    case 'frm_editor':
    case 'frm_tableparam':
        if ($option != 'popup') {
            header('content-type: application/x-javascript');
            echo "/*";
            print_r($output);
            echo "*/\n";
            echo aimsys::_message($output['message'], $output['msg_class'], false);
            echo !empty($output['js']) ? "\n" . $output['js'] : '';
        } else {
            echo str_replace("'", "`", json_encode($output));
        }
        break;
    case 'frm_storetabs':
        echo "/*";
        print_r($output);
        echo "*/\n";
        break;
    case 'frm_gettabs':
        header('content-type: application/x-javascript');
        echo <<<HTML
closeAllTabs();
var temp = {$t};
コード例 #3
0
ファイル: checkout.php プロジェクト: Gimcrack/aimsys
#id of currently logged in user
$oDate = new Date(time());
$datetime = $oDate->mysql_datetime;
/**  **  **  **  **  **  **  **  **  **
 *   SEE IF RECORD IS ALREADY CHECKED OUT
 */
$query = "SELECT `checked_out`,`checked_out_id`,`checked_out_time` FROM `{$table}` WHERE `{$prikey}` = {$id} LIMIT 1";
$oDB = new db($query);
$checkedout = count($oDB->rows) ? $oDB->rows[0]['checked_out'] : 0;
$checkedout_id = count($oDB->rows) ? $oDB->rows[0]['checked_out_id'] : 0;
$checkedout_time = count($oDB->rows) ? $oDB->rows[0]['checked_out_time'] : 0;
/**  **  **  **  **  **  **  **  **  **
 *   RECORD IS CHECKED OUT SO FIND OUT
 *   WHO HAS IT AND ALERT THE USER
 */
$checkedout_username = $checkedout_id > 0 ? aimsys::_getUsername($checkedout_id) : false;
if ($checkedout == 1) {
    // record is already checked out by another user
    $return = <<<HTML
checkout_message('That record is currently being edited by {$checkedout_username}.','error');
\$('.main-content.active .part.active #lb-edit').removeClass('ui-disabled').attr('disabled',false);
HTML;
} else {
    // checkout record
    $update = "UPDATE `{$table}` SET `checked_out` = 1,`checked_out_id` = {$userid}, `checked_out_time` = '{$datetime}'  WHERE `{$prikey}` = {$id} LIMIT 1";
    $oDB = new db($update);
    if ($oDB->ret['msg_class'] == 'success') {
        $return = <<<HTML
checkout_message('Record ready to edit.','success');
\$('.main-content.active .part.active #lb-edit').hide();
\$('.main-content.active .part.active #lb-refresh').hide();
コード例 #4
0
ファイル: class_session.php プロジェクト: Gimcrack/aimsys
 public static function _get_message()
 {
     $message = !empty($_SESSION['message']) ? aimsys::_message($_SESSION['message'], $_SESSION['msg_class'], true, true) : '';
     return $message;
 }
コード例 #5
0
ファイル: class_db.old.php プロジェクト: Gimcrack/aimsys
 public static function _get_edit_form($table, $id = 0)
 {
     $edit = $id != 0 ? true : false;
     $query = "SELECT * FROM `aimparams` WHERE `par_table` = '{$table}'";
     $oDB = new db($query);
     $rows = $oDB->rows;
     /* %s
     		1 	-	Label Class e.g. required-label
     		2	-	Label For
     		3	-	Label Text
     		4	-	Input tag name (input / select)
     		
     		*/
     $return = '<table>';
     $ret = array();
     $row_template = '<tr><td nowrap="nowrap"><label class="%s" for="%s">%s</label>&nbsp;</td><td>%s</td></tr>' . "\n";
     foreach ($rows as $key => $row) {
         if (is_numeric($key)) {
             $params = new params($row['par_id']);
             $s = array();
             $s[0] = $row_template;
             $s[1] = $params->input_required ? 'required-label' : 'optional-label';
             $s[2] = $params->table_col;
             $s[3] = $params->input_prompt;
             $s[4] = 'tag';
             switch ($params->input_type) {
                 case 'text':
                 case 'password':
                 case 'hidden':
                     //<input type="text" name="use_firstname" id="use_firstname" size="18" maxchars="25" class="required-input" validtype="Anything" />
                     $req_class = $params->input_required ? 'required-input' : '';
                     $class = $params->input_class != '' ? "class=\"{$params->input_class} {$req_class}\"" : "class=\"{$req_class}\"";
                     $validtype = $params->input_valid_types != '' ? "validtype=\"{$params->input_valid_types}\"" : '';
                     $s[4] = "<input type=\"{$params->input_type}\" name=\"{$params->table_col}\" id=\"{$params->table_col}\" {$class} {$validtype} />";
                     break;
                 case 'select':
                     $values = explode("|", $params->input_values);
                     $labels = explode("|", $params->input_labels);
                     if ($values[0] == 'foreign') {
                         $s[4] = aimsys::_get_sel_menu($params->table_col, $values[1], $labels[2], $values[2], 0, $params->input_first_value, $params->input_first_label, $params->input_multiple);
                     }
                     break;
                 default:
                     $s[4] = 'tag';
                     break;
             }
             $ret["{$params->view_order}"] = call_user_func_array('sprintf', $s);
         }
     }
     sort($ret);
     $return .= implode("\n", $ret);
     $return .= '<table>';
     return $return;
 }
コード例 #6
0
ファイル: params.php プロジェクト: Gimcrack/aimsys
 public function getFromTable($table)
 {
     $pri = aimsys::_getprimary($table);
     $query = "SELECT * FROM `{$table}` ORDER BY `{$pri}` ASC";
     $result = new db($query, true);
     $values = array();
     $labels = array();
     foreach ($result as $key => $row) {
         if (is_numeric($key)) {
             $values[] = $row[0];
             $labels[] = $row[1];
         }
     }
     $this->labels = implode("|", $labels);
     $this->values = implode("|", $values);
 }
コード例 #7
0
ファイル: class_colparams.php プロジェクト: Gimcrack/aimsys
    public function _getHtml()
    {
        $data = $this;
        $return = <<<HTML
<div class="param-table" id="param_table_{$data->table}">
HTML;
        // Create first Column
        $menu = aimsys::_array_sel_menu($data->tables, "sel_table_{$data->table}", $data->table, 0, "--Select Table--");
        $return .= <<<HTML
<div class="param-col">
\t<div class="param-cell">{$data->table}</div>
HTML;
        // Create cells for parameters
        foreach ($data->ar_params as $key => $value) {
            $return .= <<<HTML
\t<div class="param-cell">{$value}</div>
HTML;
        }
        // End First Column
        $return .= <<<HTML
<div class="param-cell"><button type="button" onclick="ajax_submit_all('#param_table_{$data->table}')">Save All</button></div>
</div>
HTML;
        // Process rest of the data
        foreach ($data->params as $key => $col) {
            // Create next Column
            $return .= <<<HTML
<div class="param-col" id="param_col_{$key}">
\t<div class="param-cell">{$key}</div>
\t<form action="index.php?controller=form&option=tableparam" method="post" id="frm_tableparam_{$key}" target="#param_col_{$key}" targetScript="1">
    <input type="hidden" name="frm_name" value="frm_tableparam" />
    <input type="hidden" name="_table" value="{$col->_table}" />
    <input type="hidden" name="_col" value="{$col->_col}" />
\t
HTML;
            // Create additional cells
            foreach ($col as $key2 => $param) {
                if (is_object($param)) {
                    $return .= @<<<HTML
\t\t\t<div title="{$param->helptext}" class="param-cell">{$param->inputhtml}</div>
HTML;
                }
            }
            // End Column
            $return .= <<<HTML
<div class="param-cell">
<button type="button" onclick="ajax_submit(this.form)">Save</button></div>
</form>
</div>
HTML;
        }
        // End Table
        $return .= <<<HTML
</div>
<div class="data row footer"></div>
HTML;
        return $return;
    }