当前位置: 首页>>代码示例>>PHP>>正文


PHP getTablePermissions函数代码示例

本文整理汇总了PHP中getTablePermissions函数的典型用法代码示例。如果您正苦于以下问题:PHP getTablePermissions函数的具体用法?PHP getTablePermissions怎么用?PHP getTablePermissions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getTablePermissions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: symptoms_form

function symptoms_form($selected_id = "", $AllowUpdate = 1, $AllowInsert = 1, $AllowDelete = 1, $ShowCancel = 0)
{
    // function to return an editable form for a table records
    // and fill it with data of record whose ID is $selected_id. If $selected_id
    // is empty, an empty form is shown, with only an 'Add New'
    // button displayed.
    global $Translation;
    // mm: get table permissions
    $arrPerm = getTablePermissions('symptoms');
    if (!$arrPerm[1] && $selected_id == "") {
        return "";
    }
    if ($selected_id) {
        // mm: check member permissions
        if (!$arrPerm[2]) {
            return "";
        }
        // mm: who is the owner?
        $ownerGroupID = sqlValue("select groupID from membership_userrecords where tableName='symptoms' and pkValue='" . makeSafe($selected_id) . "'");
        $ownerMemberID = sqlValue("select lcase(memberID) from membership_userrecords where tableName='symptoms' and pkValue='" . makeSafe($selected_id) . "'");
        if ($arrPerm[2] == 1 && getLoggedMemberID() != $ownerMemberID) {
            return "";
        }
        if ($arrPerm[2] == 2 && getLoggedGroupID() != $ownerGroupID) {
            return "";
        }
        // can edit?
        if ($arrPerm[3] == 1 && $ownerMemberID == getLoggedMemberID() || $arrPerm[3] == 2 && $ownerGroupID == getLoggedGroupID() || $arrPerm[3] == 3) {
            $AllowUpdate = 1;
        } else {
            $AllowUpdate = 0;
        }
        $res = sql("select * from `symptoms` where `id`='" . makeSafe($selected_id) . "'");
        $row = mysql_fetch_array($res);
    } else {
    }
    // code for template based detail view forms
    // open the detail view template
    if (($_POST['dvprint_x'] != '' || $_GET['dvprint_x'] != '') && $selected_id) {
        $templateCode = @implode('', @file('./templates/symptoms_templateDVP.html'));
        $dvprint = true;
    } else {
        $templateCode = @implode('', @file('./templates/symptoms_templateDV.html'));
        $dvprint = false;
    }
    // process form title
    $templateCode = str_replace('<%%DETAIL_VIEW_TITLE%%>', 'Symptom details', $templateCode);
    // unique random identifier
    $rnd1 = $dvprint ? rand(1000000, 9999999) : '';
    $templateCode = str_replace('<%%RND1%%>', $rnd1, $templateCode);
    // process buttons
    if ($arrPerm[1] && !$selected_id) {
        // allow insert and no record selected?
        $templateCode = str_replace('<%%INSERT_BUTTON%%>', '<input type="image" src="insert.gif" name="insert" alt="' . $Translation['add new record'] . '" onclick="return validateData();">', $templateCode);
    } else {
        $templateCode = str_replace('<%%INSERT_BUTTON%%>', '', $templateCode);
    }
    if ($selected_id) {
        $templateCode = str_replace('<%%DVPRINT_BUTTON%%>', '<input type="image" src="print.gif" vspace="1" name="dvprint" id="dvprint" alt="' . $Translation['printer friendly view'] . '" onclick="document.myform.reset(); return true;" style="margin-bottom: 20px;">', $templateCode);
        if ($AllowUpdate) {
            $templateCode = str_replace('<%%UPDATE_BUTTON%%>', '<input type="image" src="update.gif" vspace="1" name="update" alt="' . $Translation['update record'] . '" onclick="return validateData();">', $templateCode);
        } else {
            $templateCode = str_replace('<%%UPDATE_BUTTON%%>', '', $templateCode);
            // set records to read only if user can't insert new records
            if (!$arrPerm[1]) {
                $jsReadOnly .= "\n\n\tif(document.getElementsByName('id').length){ document.getElementsByName('id')[0].readOnly=true; }\n";
                $jsReadOnly .= "\n\n\tif(document.getElementsByName('name').length){ document.getElementsByName('name')[0].readOnly=true; }\n";
                $noUploads = true;
            }
        }
        if ($arrPerm[4] == 1 && $ownerMemberID == getLoggedMemberID() || $arrPerm[4] == 2 && $ownerGroupID == getLoggedGroupID() || $arrPerm[4] == 3) {
            // allow delete?
            $templateCode = str_replace('<%%DELETE_BUTTON%%>', '<input type="image" src="delete.gif" vspace="1" name="delete" alt="' . $Translation['delete record'] . '" onClick="return confirm(\'' . $Translation['are you sure?'] . '\');">', $templateCode);
        } else {
            $templateCode = str_replace('<%%DELETE_BUTTON%%>', '', $templateCode);
        }
        $templateCode = str_replace('<%%DESELECT_BUTTON%%>', "<input type=image src=deselect.gif vspace=1 name=deselect alt=\"" . $Translation['deselect record'] . "\" onclick=\"document.myform.reset(); return true;\">", $templateCode);
    } else {
        $templateCode = str_replace('<%%UPDATE_BUTTON%%>', '', $templateCode);
        $templateCode = str_replace('<%%DELETE_BUTTON%%>', '', $templateCode);
        $templateCode = str_replace('<%%DESELECT_BUTTON%%>', $ShowCancel ? "<input type=image src=cancel.gif vspace=1 name=deselect alt=\"" . $Translation['deselect record'] . "\" onclick=\"document.myform.reset(); return true;\">" : '', $templateCode);
    }
    // process combos
    // process foreign key links
    if ($selected_id) {
    }
    // process images
    $templateCode = str_replace('<%%UPLOADFILE(id)%%>', '', $templateCode);
    $templateCode = str_replace('<%%UPLOADFILE(name)%%>', '', $templateCode);
    $templateCode = str_replace('<%%UPLOADFILE(description)%%>', '', $templateCode);
    $templateCode = str_replace('<%%UPLOADFILE(comments)%%>', '', $templateCode);
    // process values
    if ($selected_id) {
        $templateCode = str_replace('<%%VALUE(id)%%>', htmlspecialchars($row['id'], ENT_QUOTES), $templateCode);
        $templateCode = str_replace('<%%VALUE(name)%%>', htmlspecialchars($row['name'], ENT_QUOTES), $templateCode);
        if ($AllowUpdate || $AllowInsert) {
            $templateCode = str_replace('<%%HTMLAREA(description)%%>', '<textarea name="description" id="description" cols="50" rows="5" class="TextBox">' . htmlspecialchars($row['description'], ENT_QUOTES) . '</textarea>', $templateCode);
        } else {
            $templateCode = str_replace('<%%HTMLAREA(description)%%>', $row['description'], $templateCode);
        }
//.........这里部分代码省略.........
开发者ID:bigprof,项目名称:Symptoms-and-diseases-database,代码行数:101,代码来源:symptoms_dml.php

示例2: Render

 function Render()
 {
     global $Translation;
     $eo['silentErrors'] = true;
     $result = sql($this->Query . ' limit ' . datalist_auto_complete_size, $eo);
     if ($eo['error'] != '') {
         $this->HTML = error_message(htmlspecialchars($eo['error']) . "\n\n<!--\n{$Translation['query:']}\n {$this->Query}\n-->\n\n");
         return;
     }
     $this->ItemCount = db_num_rows($result);
     $combo = new Combo();
     $combo->Class = $this->Class;
     $combo->Style = $this->Style;
     $combo->SelectName = $this->SelectName;
     $combo->SelectedData = $this->SelectedData;
     $combo->SelectedText = $this->SelectedText;
     $combo->SelectedClass = 'SelectedOption';
     $combo->ListType = $this->ListType;
     $combo->ListBoxHeight = $this->ListBoxHeight;
     $combo->RadiosPerLine = $this->RadiosPerLine;
     $combo->AllowNull = $this->ListType == 2 ? 0 : $this->AllowNull;
     while ($row = db_fetch_row($result)) {
         $combo->ListData[] = htmlspecialchars($row[0], ENT_QUOTES, 'iso-8859-1');
         $combo->ListItem[] = $row[1];
     }
     $combo->Render();
     $this->MatchText = $combo->MatchText;
     $this->SelectedText = $combo->SelectedText;
     $this->SelectedData = $combo->SelectedData;
     if ($this->ListType == 2) {
         $rnd = rand(100, 999);
         $SelectedID = htmlspecialchars(urlencode($this->SelectedData));
         $pt_perm = getTablePermissions($this->parent_table);
         if ($pt_perm['view'] || $pt_perm['edit']) {
             $this->HTML = str_replace(">{$this->MatchText}</label>", ">{$this->MatchText}</label> <button type=\"button\" class=\"btn btn-default view_parent hspacer-lg\" id=\"{$this->parent_table}_view_parent\" title=" . htmlspecialchars($Translation['View']) . "><i class=\"glyphicon glyphicon-eye-open\"></i></button>", $combo->HTML);
         }
         $this->HTML = str_replace(' type="radio" ', ' type="radio" onclick="' . $this->SelectName . '_changed();" ', $this->HTML);
     } else {
         $this->HTML = $combo->HTML;
     }
 }
开发者ID:TokaMElTorkey,项目名称:northwind,代码行数:41,代码来源:data_combo.class.php

示例3: orders_form

function orders_form($selected_id = '', $AllowUpdate = 1, $AllowInsert = 1, $AllowDelete = 1, $ShowCancel = 0)
{
    // function to return an editable form for a table records
    // and fill it with data of record whose ID is $selected_id. If $selected_id
    // is empty, an empty form is shown, with only an 'Add New'
    // button displayed.
    global $Translation;
    // mm: get table permissions
    $arrPerm = getTablePermissions('orders');
    if (!$arrPerm[1] && $selected_id == '') {
        return '';
    }
    $AllowInsert = $arrPerm[1] ? true : false;
    // print preview?
    $dvprint = false;
    if ($selected_id && $_REQUEST['dvprint_x'] != '') {
        $dvprint = true;
    }
    $filterer_CustomerID = thisOr(undo_magic_quotes($_REQUEST['filterer_CustomerID']), '');
    $filterer_EmployeeID = thisOr(undo_magic_quotes($_REQUEST['filterer_EmployeeID']), '');
    $filterer_ShipVia = thisOr(undo_magic_quotes($_REQUEST['filterer_ShipVia']), '');
    // populate filterers, starting from children to grand-parents
    // unique random identifier
    $rnd1 = $dvprint ? rand(1000000, 9999999) : '';
    // combobox: CustomerID
    $combo_CustomerID = new DataCombo();
    // combobox: EmployeeID
    $combo_EmployeeID = new DataCombo();
    // combobox: OrderDate
    $combo_OrderDate = new DateCombo();
    $combo_OrderDate->DateFormat = "mdy";
    $combo_OrderDate->MinYear = 1900;
    $combo_OrderDate->MaxYear = 2100;
    $combo_OrderDate->DefaultDate = parseMySQLDate('1', '1');
    $combo_OrderDate->MonthNames = $Translation['month names'];
    $combo_OrderDate->NamePrefix = 'OrderDate';
    // combobox: RequiredDate
    $combo_RequiredDate = new DateCombo();
    $combo_RequiredDate->DateFormat = "mdy";
    $combo_RequiredDate->MinYear = 1900;
    $combo_RequiredDate->MaxYear = 2100;
    $combo_RequiredDate->DefaultDate = parseMySQLDate('1', '1');
    $combo_RequiredDate->MonthNames = $Translation['month names'];
    $combo_RequiredDate->NamePrefix = 'RequiredDate';
    // combobox: ShippedDate
    $combo_ShippedDate = new DateCombo();
    $combo_ShippedDate->DateFormat = "mdy";
    $combo_ShippedDate->MinYear = 1900;
    $combo_ShippedDate->MaxYear = 2100;
    $combo_ShippedDate->DefaultDate = parseMySQLDate('', '');
    $combo_ShippedDate->MonthNames = $Translation['month names'];
    $combo_ShippedDate->NamePrefix = 'ShippedDate';
    // combobox: ShipVia
    $combo_ShipVia = new DataCombo();
    if ($selected_id) {
        // mm: check member permissions
        if (!$arrPerm[2]) {
            return "";
        }
        // mm: who is the owner?
        $ownerGroupID = sqlValue("select groupID from membership_userrecords where tableName='orders' and pkValue='" . makeSafe($selected_id) . "'");
        $ownerMemberID = sqlValue("select lcase(memberID) from membership_userrecords where tableName='orders' and pkValue='" . makeSafe($selected_id) . "'");
        if ($arrPerm[2] == 1 && getLoggedMemberID() != $ownerMemberID) {
            return "";
        }
        if ($arrPerm[2] == 2 && getLoggedGroupID() != $ownerGroupID) {
            return "";
        }
        // can edit?
        if ($arrPerm[3] == 1 && $ownerMemberID == getLoggedMemberID() || $arrPerm[3] == 2 && $ownerGroupID == getLoggedGroupID() || $arrPerm[3] == 3) {
            $AllowUpdate = 1;
        } else {
            $AllowUpdate = 0;
        }
        $res = sql("select * from `orders` where `OrderID`='" . makeSafe($selected_id) . "'", $eo);
        if (!($row = db_fetch_array($res))) {
            return error_message($Translation['No records found']);
        }
        $urow = $row;
        /* unsanitized data */
        $hc = new CI_Input();
        $row = $hc->xss_clean($row);
        /* sanitize data */
        $combo_CustomerID->SelectedData = $row['CustomerID'];
        $combo_EmployeeID->SelectedData = $row['EmployeeID'];
        $combo_OrderDate->DefaultDate = $row['OrderDate'];
        $combo_RequiredDate->DefaultDate = $row['RequiredDate'];
        $combo_ShippedDate->DefaultDate = $row['ShippedDate'];
        $combo_ShipVia->SelectedData = $row['ShipVia'];
    } else {
        $combo_CustomerID->SelectedData = $filterer_CustomerID;
        $combo_EmployeeID->SelectedData = $filterer_EmployeeID;
        $combo_ShipVia->SelectedData = $filterer_ShipVia;
    }
    $combo_CustomerID->HTML = '<span id="CustomerID-container' . $rnd1 . '"></span><input type="hidden" name="CustomerID" id="CustomerID' . $rnd1 . '" value="' . htmlspecialchars($combo_CustomerID->SelectedData, ENT_QUOTES, 'iso-8859-1') . '">';
    $combo_CustomerID->MatchText = '<span id="CustomerID-container-readonly' . $rnd1 . '"></span><input type="hidden" name="CustomerID" id="CustomerID' . $rnd1 . '" value="' . htmlspecialchars($combo_CustomerID->SelectedData, ENT_QUOTES, 'iso-8859-1') . '">';
    $combo_EmployeeID->HTML = '<span id="EmployeeID-container' . $rnd1 . '"></span><input type="hidden" name="EmployeeID" id="EmployeeID' . $rnd1 . '" value="' . htmlspecialchars($combo_EmployeeID->SelectedData, ENT_QUOTES, 'iso-8859-1') . '">';
    $combo_EmployeeID->MatchText = '<span id="EmployeeID-container-readonly' . $rnd1 . '"></span><input type="hidden" name="EmployeeID" id="EmployeeID' . $rnd1 . '" value="' . htmlspecialchars($combo_EmployeeID->SelectedData, ENT_QUOTES, 'iso-8859-1') . '">';
    $combo_ShipVia->HTML = '<span id="ShipVia-container' . $rnd1 . '"></span><input type="hidden" name="ShipVia" id="ShipVia' . $rnd1 . '" value="' . htmlspecialchars($combo_ShipVia->SelectedData, ENT_QUOTES, 'iso-8859-1') . '">';
    $combo_ShipVia->MatchText = '<span id="ShipVia-container-readonly' . $rnd1 . '"></span><input type="hidden" name="ShipVia" id="ShipVia' . $rnd1 . '" value="' . htmlspecialchars($combo_ShipVia->SelectedData, ENT_QUOTES, 'iso-8859-1') . '">';
//.........这里部分代码省略.........
开发者ID:bigprof,项目名称:appgini-mssql,代码行数:101,代码来源:orders_dml.php

示例4: dirname

<?php

// This script and data application were generated by AppGini 5.23
// Download AppGini for free from http://bigprof.com/appgini/download/
$currDir = dirname(__FILE__);
include "{$currDir}/defaultLang.php";
include "{$currDir}/language.php";
include "{$currDir}/lib.php";
@(include "{$currDir}/hooks/companies.php");
include "{$currDir}/companies_dml.php";
// mm: can the current member access this page?
$perm = getTablePermissions('companies');
if (!$perm[0]) {
    echo error_message($Translation['tableAccessDenied'], false);
    echo '<script>setTimeout("window.location=\'index.php?signOut=1\'", 2000);</script>';
    exit;
}
$x = new DataList();
$x->TableName = "companies";
// Fields that can be displayed in the table view
$x->QueryFieldsTV = array("`companies`.`company_id`" => "company_id", "`companies`.`name`" => "name", "IF(    CHAR_LENGTH(`clients1`.`name`), CONCAT_WS('',   `clients1`.`name`), '') /* Client */" => "client", "`companies`.`website`" => "website", "`companies`.`description`" => "description", "`companies`.`founded`" => "founded", "`companies`.`industry`" => "industry", "`companies`.`company_number`" => "company_number", "`companies`.`country_hq`" => "country_hq", "`companies`.`country_operations`" => "country_operations", "`companies`.`num_employees`" => "num_employees", "`companies`.`company_type`" => "company_type", "IF(    CHAR_LENGTH(`sic1`.`code`) || CHAR_LENGTH(`sic1`.`activity`), CONCAT_WS('',   `sic1`.`code`, ' - ', `sic1`.`activity`), '') /* SIC code */" => "sic_code", "if(`companies`.`created`,date_format(`companies`.`created`,'%d/%m/%Y'),'')" => "created", "`companies`.`created_by`" => "created_by");
// mapping incoming sort by requests to actual query fields
$x->SortFields = array(1 => '`companies`.`company_id`', 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => '`companies`.`founded`', 7 => 7, 8 => '`companies`.`company_number`', 9 => 9, 10 => 10, 11 => '`companies`.`num_employees`', 12 => 12, 13 => 13, 14 => '`companies`.`created`', 15 => 15);
// Fields that can be displayed in the csv file
$x->QueryFieldsCSV = array("`companies`.`company_id`" => "company_id", "`companies`.`name`" => "name", "IF(    CHAR_LENGTH(`clients1`.`name`), CONCAT_WS('',   `clients1`.`name`), '') /* Client */" => "client", "`companies`.`website`" => "website", "`companies`.`description`" => "description", "`companies`.`founded`" => "founded", "`companies`.`industry`" => "industry", "`companies`.`company_number`" => "company_number", "`companies`.`country_hq`" => "country_hq", "`companies`.`country_operations`" => "country_operations", "`companies`.`num_employees`" => "num_employees", "`companies`.`company_type`" => "company_type", "IF(    CHAR_LENGTH(`sic1`.`code`) || CHAR_LENGTH(`sic1`.`activity`), CONCAT_WS('',   `sic1`.`code`, ' - ', `sic1`.`activity`), '') /* SIC code */" => "sic_code", "if(`companies`.`created`,date_format(`companies`.`created`,'%d/%m/%Y'),'')" => "created", "`companies`.`created_by`" => "created_by");
// Fields that can be filtered
$x->QueryFieldsFilters = array("`companies`.`company_id`" => "ID", "`companies`.`name`" => "Name", "IF(    CHAR_LENGTH(`clients1`.`name`), CONCAT_WS('',   `clients1`.`name`), '') /* Client */" => "Client", "`companies`.`website`" => "Website", "`companies`.`description`" => "Description", "`companies`.`founded`" => "Year founded", "`companies`.`industry`" => "Industry", "`companies`.`company_number`" => "Company number", "`companies`.`country_hq`" => "Country based", "`companies`.`country_operations`" => "Country of operations", "`companies`.`num_employees`" => "Number of employees", "`companies`.`company_type`" => "Company type", "IF(    CHAR_LENGTH(`sic1`.`code`) || CHAR_LENGTH(`sic1`.`activity`), CONCAT_WS('',   `sic1`.`code`, ' - ', `sic1`.`activity`), '') /* SIC code */" => "SIC code", "`companies`.`created`" => "Date created", "`companies`.`created_by`" => "Created by");
// Fields that can be quick searched
$x->QueryFieldsQS = array("`companies`.`company_id`" => "company_id", "`companies`.`name`" => "name", "IF(    CHAR_LENGTH(`clients1`.`name`), CONCAT_WS('',   `clients1`.`name`), '') /* Client */" => "client", "`companies`.`website`" => "website", "`companies`.`description`" => "description", "`companies`.`founded`" => "founded", "`companies`.`industry`" => "industry", "`companies`.`company_number`" => "company_number", "`companies`.`country_hq`" => "country_hq", "`companies`.`country_operations`" => "country_operations", "`companies`.`num_employees`" => "num_employees", "`companies`.`company_type`" => "company_type", "IF(    CHAR_LENGTH(`sic1`.`code`) || CHAR_LENGTH(`sic1`.`activity`), CONCAT_WS('',   `sic1`.`code`, ' - ', `sic1`.`activity`), '') /* SIC code */" => "sic_code", "if(`companies`.`created`,date_format(`companies`.`created`,'%d/%m/%Y'),'')" => "created", "`companies`.`created_by`" => "created_by");
// Lookup fields that can be used as filterers
$x->filterers = array('client' => 'Client', 'sic_code' => 'SIC code');
开发者ID:centaurustech,项目名称:git-SID,代码行数:31,代码来源:companies_view.php

示例5: Render


//.........这里部分代码省略.........
         $SortField = '';
     }
     if (!preg_match('/^(asc|desc)$/i', $SortDirection)) {
         $SortDirection = '';
     }
     if (!$this->AllowDelete) {
         $delete_x = '';
     }
     if (!$this->AllowDeleteOfParents) {
         $SkipChecks = '';
     }
     if (!$this->AllowInsert) {
         $insert_x = '';
         $addNew_x = '';
     }
     if (!$this->AllowUpdate) {
         $update_x = '';
     }
     if (!$this->AllowFilters) {
         $Filter_x = '';
     }
     if (!$this->AllowPrinting) {
         $Print_x = '';
         $PrintTV = '';
     }
     if (!$this->QuickSearch) {
         $SearchString = '';
     }
     if (!$this->AllowCSV) {
         $CSV_x = '';
     }
     // enforce record selection if user has edit/delete permissions on the current table
     $AllowPrintDV = 1;
     $this->Permissions = getTablePermissions($this->TableName);
     if ($this->Permissions[3] || $this->Permissions[4]) {
         // current user can edit or delete?
         $this->AllowSelection = 1;
     } elseif (!$this->AllowSelection) {
         $SelectedID = '';
         $AllowPrintDV = 0;
         $PrintDV = '';
     }
     if (!$this->AllowSelection || !$SelectedID) {
         $dvprint_x = '';
     }
     $this->QueryFieldsIndexed = reIndex($this->QueryFieldsFilters);
     // determine type of current view: TV, DV, TVDV, TVP, DVP or Filters?
     if ($this->SeparateDV) {
         $current_view = 'TV';
         if ($Print_x != '' || $PrintTV != '') {
             $current_view = 'TVP';
         } elseif ($dvprint_x != '' || $PrintDV != '') {
             $current_view = 'DVP';
         } elseif ($Filter_x != '') {
             $current_view = 'Filters';
         } elseif ($SelectedID && !$deselect_x && !$delete_x || $addNew_x != '') {
             $current_view = 'DV';
         }
     } else {
         $current_view = 'TVDV';
         if ($Print_x != '' || $PrintTV != '') {
             $current_view = 'TVP';
         } elseif ($dvprint_x != '' || $PrintDV != '') {
             $current_view = 'DVP';
         } elseif ($Filter_x != '') {
             $current_view = 'Filters';
开发者ID:ahmedandroid1980,项目名称:appgini,代码行数:67,代码来源:datalist.php

示例6: dirname

$currDir = dirname(__FILE__);
include "{$currDir}/defaultLang.php";
include "{$currDir}/language.php";
include "{$currDir}/lib.php";
/**
 * dynamic configuration based on current user's permissions
 * $userPCConfig array is populated only with parent tables where the user has access to
 * at least one child table
 */
$userPCConfig = array();
foreach ($pcConfig as $pcChildTable => $ChildrenLookups) {
    $permChild = getTablePermissions($pcChildTable);
    if ($permChild[2]) {
        // user can view records of the child table, so proceed to check children lookups
        foreach ($ChildrenLookups as $ChildLookupField => $ChildConfig) {
            $permParent = getTablePermissions($ChildConfig['parent-table']);
            if ($permParent[2]) {
                // user can view records of parent table
                $userPCConfig[$pcChildTable][$ChildLookupField] = $pcConfig[$pcChildTable][$ChildLookupField];
                // show add new only if configured above AND the user has insert permission
                if ($permChild[1] && $pcConfig[$pcChildTable][$ChildLookupField]['display-add-new']) {
                    $userPCConfig[$pcChildTable][$ChildLookupField]['display-add-new'] = true;
                } else {
                    $userPCConfig[$pcChildTable][$ChildLookupField]['display-add-new'] = false;
                }
            }
        }
    }
}
/* Receive, UTF-convert, and validate parameters */
$ParentTable = $_REQUEST['ParentTable'];
开发者ID:vishwanathhsinhaa,项目名称:tieuthuong-org,代码行数:31,代码来源:parent-children.php

示例7: makeSafe

$table_name = $_REQUEST['t'];
$field_name = $_REQUEST['f'];
$search_id = makeSafe(iconv('UTF-8', datalist_db_encoding, $_REQUEST['id']));
$selected_text = iconv('UTF-8', datalist_db_encoding, $_REQUEST['text']);
$returnOptions = $_REQUEST['o'] == 1 ? true : false;
$page = intval($_REQUEST['p']);
if ($page < 1) {
    $page = 1;
}
$skip = $results_per_page * ($page - 1);
$search_term = makeSafe(iconv('UTF-8', datalist_db_encoding, $_REQUEST['s']));
if (!isset($lookups[$table_name][$field_name])) {
    die('{ "error": "Invalid table or field." }');
}
// can user access the requested table?
$perm = getTablePermissions($table_name);
if (!$perm[0] && !$search_id) {
    die('{ "error": "' . addslashes($Translation['tableAccessDenied']) . '" }');
}
$field = $lookups[$table_name][$field_name];
$wheres = array();
// search term provided?
if ($search_term) {
    $wheres[] = "{$field['parent_caption']} like '%{$search_term}%'";
}
// any filterers specified?
if (is_array($field['filterers'])) {
    foreach ($field['filterers'] as $filterer => $filterer_parent) {
        $get = isset($_REQUEST["filterer_{$filterer}"]) ? $_REQUEST["filterer_{$filterer}"] : false;
        if ($get) {
            $wheres[] = "`{$field['parent_table']}`.`{$filterer_parent}`='" . makeSafe($get) . "'";
开发者ID:bigprof,项目名称:jaap,代码行数:31,代码来源:ajax_combo.php

示例8: submitlog_form

function submitlog_form($selected_id = '', $AllowUpdate = 1, $AllowInsert = 1, $AllowDelete = 1, $ShowCancel = 0)
{
    // function to return an editable form for a table records
    // and fill it with data of record whose ID is $selected_id. If $selected_id
    // is empty, an empty form is shown, with only an 'Add New'
    // button displayed.
    global $Translation;
    // mm: get table permissions
    $arrPerm = getTablePermissions('submitlog');
    if (!$arrPerm[1] && $selected_id == '') {
        return '';
    }
    $AllowInsert = $arrPerm[1] ? true : false;
    // print preview?
    $dvprint = false;
    if ($selected_id && $_REQUEST['dvprint_x'] != '') {
        $dvprint = true;
    }
    // populate filterers, starting from children to grand-parents
    // unique random identifier
    $rnd1 = $dvprint ? rand(1000000, 9999999) : '';
    // combobox: pdate
    $combo_pdate = new DateCombo();
    $combo_pdate->DateFormat = "mdy";
    $combo_pdate->MinYear = 1900;
    $combo_pdate->MaxYear = 2100;
    $combo_pdate->DefaultDate = parseMySQLDate('', '');
    $combo_pdate->MonthNames = $Translation['month names'];
    $combo_pdate->NamePrefix = 'pdate';
    if ($selected_id) {
        // mm: check member permissions
        if (!$arrPerm[2]) {
            return "";
        }
        // mm: who is the owner?
        $ownerGroupID = sqlValue("select groupID from membership_userrecords where tableName='submitlog' and pkValue='" . makeSafe($selected_id) . "'");
        $ownerMemberID = sqlValue("select lcase(memberID) from membership_userrecords where tableName='submitlog' and pkValue='" . makeSafe($selected_id) . "'");
        if ($arrPerm[2] == 1 && getLoggedMemberID() != $ownerMemberID) {
            return "";
        }
        if ($arrPerm[2] == 2 && getLoggedGroupID() != $ownerGroupID) {
            return "";
        }
        // can edit?
        if ($arrPerm[3] == 1 && $ownerMemberID == getLoggedMemberID() || $arrPerm[3] == 2 && $ownerGroupID == getLoggedGroupID() || $arrPerm[3] == 3) {
            $AllowUpdate = 1;
        } else {
            $AllowUpdate = 0;
        }
        $res = sql("select * from `submitlog` where `submid`='" . makeSafe($selected_id) . "'", $eo);
        if (!($row = db_fetch_array($res))) {
            return error_message($Translation['No records found']);
        }
        $urow = $row;
        /* unsanitized data */
        $hc = new CI_Input();
        $row = $hc->xss_clean($row);
        /* sanitize data */
        $combo_pdate->DefaultDate = $row['pdate'];
    } else {
    }
    // code for template based detail view forms
    // open the detail view template
    $templateCode = @file_get_contents('./templates/submitlog_templateDV.html');
    // process form title
    $templateCode = str_replace('<%%DETAIL_VIEW_TITLE%%>', 'Filtered Submissions', $templateCode);
    $templateCode = str_replace('<%%RND1%%>', $rnd1, $templateCode);
    $templateCode = str_replace('<%%EMBEDDED%%>', $_REQUEST['Embedded'] ? 'Embedded=1' : '', $templateCode);
    // process buttons
    if ($arrPerm[1] && !$selected_id) {
        // allow insert and no record selected?
        if (!$selected_id) {
            $templateCode = str_replace('<%%INSERT_BUTTON%%>', '<button type="submit" class="btn btn-success" id="insert" name="insert_x" value="1" onclick="return submitlog_validateData();"><i class="glyphicon glyphicon-plus-sign"></i> ' . $Translation['Save New'] . '</button>', $templateCode);
        }
        $templateCode = str_replace('<%%INSERT_BUTTON%%>', '<button type="submit" class="btn btn-default" id="insert" name="insert_x" value="1" onclick="return submitlog_validateData();"><i class="glyphicon glyphicon-plus-sign"></i> ' . $Translation['Save As Copy'] . '</button>', $templateCode);
    } else {
        $templateCode = str_replace('<%%INSERT_BUTTON%%>', '', $templateCode);
    }
    // 'Back' button action
    if ($_REQUEST['Embedded']) {
        $backAction = 'window.parent.jQuery(\'.modal\').modal(\'hide\'); return false;';
    } else {
        $backAction = '$$(\'form\')[0].writeAttribute(\'novalidate\', \'novalidate\'); document.myform.reset(); return true;';
    }
    if ($selected_id) {
        if ($AllowUpdate) {
            $templateCode = str_replace('<%%UPDATE_BUTTON%%>', '<button type="submit" class="btn btn-success btn-lg" id="update" name="update_x" value="1" onclick="return submitlog_validateData();"><i class="glyphicon glyphicon-ok"></i> ' . $Translation['Save Changes'] . '</button>', $templateCode);
        } else {
            $templateCode = str_replace('<%%UPDATE_BUTTON%%>', '', $templateCode);
        }
        if ($arrPerm[4] == 1 && $ownerMemberID == getLoggedMemberID() || $arrPerm[4] == 2 && $ownerGroupID == getLoggedGroupID() || $arrPerm[4] == 3) {
            // allow delete?
            $templateCode = str_replace('<%%DELETE_BUTTON%%>', '<button type="submit" class="btn btn-danger" id="delete" name="delete_x" value="1" onclick="return confirm(\'' . $Translation['are you sure?'] . '\');"><i class="glyphicon glyphicon-trash"></i> ' . $Translation['Delete'] . '</button>', $templateCode);
        } else {
            $templateCode = str_replace('<%%DELETE_BUTTON%%>', '', $templateCode);
        }
        $templateCode = str_replace('<%%DESELECT_BUTTON%%>', '<button type="submit" class="btn btn-default" id="deselect" name="deselect_x" value="1" onclick="' . $backAction . '"><i class="glyphicon glyphicon-chevron-left"></i> ' . $Translation['Back'] . '</button>', $templateCode);
    } else {
        $templateCode = str_replace('<%%UPDATE_BUTTON%%>', '', $templateCode);
        $templateCode = str_replace('<%%DELETE_BUTTON%%>', '', $templateCode);
//.........这里部分代码省略.........
开发者ID:WebxOne,项目名称:swldbav0.6,代码行数:101,代码来源:submitlog_dml.php

示例9: dirname

<?php

// This script and data application were generated by AppGini 5.50
// Download AppGini for free from http://bigprof.com/appgini/download/
$currDir = dirname(__FILE__);
include "{$currDir}/defaultLang.php";
include "{$currDir}/language.php";
include "{$currDir}/lib.php";
@(include "{$currDir}/hooks/customurls.php");
include "{$currDir}/customurls_dml.php";
// mm: can the current member access this page?
$perm = getTablePermissions('customurls');
if (!$perm[0]) {
    echo error_message($Translation['tableAccessDenied'], false);
    echo '<script>setTimeout("window.location=\'index.php?signOut=1\'", 2000);</script>';
    exit;
}
$x = new DataList();
$x->TableName = "customurls";
// Fields that can be displayed in the table view
$x->QueryFieldsTV = array("`customurls`.`customid`" => "customid", "`customurls`.`progid`" => "progid", "`customurls`.`customurl`" => "customurl");
// mapping incoming sort by requests to actual query fields
$x->SortFields = array(1 => '`customurls`.`customid`', 2 => '`customurls`.`progid`', 3 => 3);
// Fields that can be displayed in the csv file
$x->QueryFieldsCSV = array("`customurls`.`customid`" => "customid", "`customurls`.`progid`" => "progid", "`customurls`.`customurl`" => "customurl");
// Fields that can be filtered
$x->QueryFieldsFilters = array("`customurls`.`customid`" => "customid", "`customurls`.`progid`" => "progid", "`customurls`.`customurl`" => "customurl");
// Fields that can be quick searched
$x->QueryFieldsQS = array("`customurls`.`customid`" => "customid", "`customurls`.`progid`" => "progid", "`customurls`.`customurl`" => "customurl");
// Lookup fields that can be used as filterers
$x->filterers = array();
开发者ID:WebxOne,项目名称:swldbav0.6,代码行数:31,代码来源:customurls_view.php

示例10: dirname

<?php

// This script and data application were generated by AppGini 5.42
// Download AppGini for free from http://bigprof.com/appgini/download/
$currDir = dirname(__FILE__);
include "{$currDir}/defaultLang.php";
include "{$currDir}/language.php";
include "{$currDir}/lib.php";
@(include "{$currDir}/hooks/products.php");
include "{$currDir}/products_dml.php";
// mm: can the current member access this page?
$perm = getTablePermissions('products');
if (!$perm[0]) {
    echo error_message($Translation['tableAccessDenied'], false);
    echo '<script>setTimeout("window.location=\'index.php?signOut=1\'", 2000);</script>';
    exit;
}
$x = new DataList();
$x->TableName = "products";
// Fields that can be displayed in the table view
$x->QueryFieldsTV = array("`products`.`ProductID`" => "ProductID", "`products`.`ProductName`" => "ProductName", "IF(    CHAR_LENGTH(`suppliers1`.`CompanyName`), CONCAT_WS('',   `suppliers1`.`CompanyName`), '') /* Supplier */" => "SupplierID", "IF(    CHAR_LENGTH(`categories1`.`CategoryName`), CONCAT_WS('',   `categories1`.`CategoryName`), '') /* Category */" => "CategoryID", "`products`.`QuantityPerUnit`" => "QuantityPerUnit", "CONCAT('\$', FORMAT(`products`.`UnitPrice`, 2))" => "UnitPrice", "`products`.`UnitsInStock`" => "UnitsInStock", "`products`.`UnitsOnOrder`" => "UnitsOnOrder", "`products`.`ReorderLevel`" => "ReorderLevel", "concat('<img src=\"', if(`products`.`Discontinued`, 'checked.gif', 'checkednot.gif'), '\" border=\"0\" />')" => "Discontinued");
// mapping incoming sort by requests to actual query fields
$x->SortFields = array(1 => '`products`.`ProductID`', 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => '`products`.`UnitPrice`', 7 => '`products`.`UnitsInStock`', 8 => '`products`.`UnitsOnOrder`', 9 => '`products`.`ReorderLevel`', 10 => '`products`.`Discontinued`');
// Fields that can be displayed in the csv file
$x->QueryFieldsCSV = array("`products`.`ProductID`" => "ProductID", "`products`.`ProductName`" => "ProductName", "IF(    CHAR_LENGTH(`suppliers1`.`CompanyName`), CONCAT_WS('',   `suppliers1`.`CompanyName`), '') /* Supplier */" => "SupplierID", "IF(    CHAR_LENGTH(`categories1`.`CategoryName`), CONCAT_WS('',   `categories1`.`CategoryName`), '') /* Category */" => "CategoryID", "`products`.`QuantityPerUnit`" => "QuantityPerUnit", "CONCAT('\$', FORMAT(`products`.`UnitPrice`, 2))" => "UnitPrice", "`products`.`UnitsInStock`" => "UnitsInStock", "`products`.`UnitsOnOrder`" => "UnitsOnOrder", "`products`.`ReorderLevel`" => "ReorderLevel", "`products`.`Discontinued`" => "Discontinued");
// Fields that can be filtered
$x->QueryFieldsFilters = array("`products`.`ProductID`" => "Product ID", "`products`.`ProductName`" => "Product Name", "IF(    CHAR_LENGTH(`suppliers1`.`CompanyName`), CONCAT_WS('',   `suppliers1`.`CompanyName`), '') /* Supplier */" => "Supplier", "IF(    CHAR_LENGTH(`categories1`.`CategoryName`), CONCAT_WS('',   `categories1`.`CategoryName`), '') /* Category */" => "Category", "`products`.`QuantityPerUnit`" => "Quantity Per Unit", "`products`.`UnitPrice`" => "Unit Price", "`products`.`UnitsInStock`" => "Units In Stock", "`products`.`UnitsOnOrder`" => "Units On Order", "`products`.`ReorderLevel`" => "Reorder Level", "`products`.`Discontinued`" => "Discontinued");
// Fields that can be quick searched
$x->QueryFieldsQS = array("`products`.`ProductID`" => "ProductID", "`products`.`ProductName`" => "ProductName", "IF(    CHAR_LENGTH(`suppliers1`.`CompanyName`), CONCAT_WS('',   `suppliers1`.`CompanyName`), '') /* Supplier */" => "SupplierID", "IF(    CHAR_LENGTH(`categories1`.`CategoryName`), CONCAT_WS('',   `categories1`.`CategoryName`), '') /* Category */" => "CategoryID", "`products`.`QuantityPerUnit`" => "QuantityPerUnit", "CONCAT('\$', FORMAT(`products`.`UnitPrice`, 2))" => "UnitPrice", "`products`.`UnitsInStock`" => "UnitsInStock", "`products`.`UnitsOnOrder`" => "UnitsOnOrder", "`products`.`ReorderLevel`" => "ReorderLevel", "concat('<img src=\"', if(`products`.`Discontinued`, 'checked.gif', 'checkednot.gif'), '\" border=\"0\" />')" => "Discontinued");
// Lookup fields that can be used as filterers
$x->filterers = array('SupplierID' => 'Supplier', 'CategoryID' => 'Category');
开发者ID:ahmedandroid1980,项目名称:appgini,代码行数:31,代码来源:products_view.php

示例11: foreach

	}
</style>


<div class="row" id="table_links">
	<?php 
/* accessible tables */
if (is_array($arrTables) && count($arrTables)) {
    $i = 0;
    foreach ($arrTables as $tn => $tc) {
        $tChkFF = array_search($tn, array());
        $tChkHL = array_search($tn, array('order_details'));
        if ($tChkHL !== false && $tChkHL !== null) {
            continue;
        }
        $t_perm = getTablePermissions($tn);
        $can_insert = $t_perm['insert'];
        $searchFirst = $tChkFF !== false && $tChkFF !== null ? '?Filter_x=1' : '';
        ?>
				<div id="<?php 
        echo $tn;
        ?>
-tile" class="col-xs-12 <?php 
        echo !$i ? $block_classes['first']['grid_column'] : $block_classes['other']['grid_column'];
        ?>
">
					<div class="panel <?php 
        echo !$i ? $block_classes['first']['panel'] : $block_classes['other']['panel'];
        ?>
">
						<div class="panel-body">
开发者ID:ahmedandroid1980,项目名称:appgini,代码行数:31,代码来源:home.php

示例12: dirname

<?php

// This script and data application were generated by AppGini 5.23
// Download AppGini for free from http://bigprof.com/appgini/download/
$currDir = dirname(__FILE__);
include "{$currDir}/defaultLang.php";
include "{$currDir}/language.php";
include "{$currDir}/lib.php";
@(include "{$currDir}/hooks/beneficiary_groups.php");
include "{$currDir}/beneficiary_groups_dml.php";
// mm: can the current member access this page?
$perm = getTablePermissions('beneficiary_groups');
if (!$perm[0]) {
    echo error_message($Translation['tableAccessDenied'], false);
    echo '<script>setTimeout("window.location=\'index.php?signOut=1\'", 2000);</script>';
    exit;
}
$x = new DataList();
$x->TableName = "beneficiary_groups";
// Fields that can be displayed in the table view
$x->QueryFieldsTV = array("`beneficiary_groups`.`beneficiary_group_id`" => "beneficiary_group_id", "`beneficiary_groups`.`name`" => "name", "`beneficiary_groups`.`description`" => "description");
// mapping incoming sort by requests to actual query fields
$x->SortFields = array(1 => '`beneficiary_groups`.`beneficiary_group_id`', 2 => 2, 3 => 3);
// Fields that can be displayed in the csv file
$x->QueryFieldsCSV = array("`beneficiary_groups`.`beneficiary_group_id`" => "beneficiary_group_id", "`beneficiary_groups`.`name`" => "name", "`beneficiary_groups`.`description`" => "description");
// Fields that can be filtered
$x->QueryFieldsFilters = array("`beneficiary_groups`.`beneficiary_group_id`" => "ID", "`beneficiary_groups`.`name`" => "Name", "`beneficiary_groups`.`description`" => "Description");
// Fields that can be quick searched
$x->QueryFieldsQS = array("`beneficiary_groups`.`beneficiary_group_id`" => "beneficiary_group_id", "`beneficiary_groups`.`name`" => "name", "`beneficiary_groups`.`description`" => "description");
// Lookup fields that can be used as filterers
$x->filterers = array();
开发者ID:centaurustech,项目名称:git-SID,代码行数:31,代码来源:beneficiary_groups_view.php

示例13: outcomes_form

function outcomes_form($selected_id = '', $AllowUpdate = 1, $AllowInsert = 1, $AllowDelete = 1, $ShowCancel = 0)
{
    // function to return an editable form for a table records
    // and fill it with data of record whose ID is $selected_id. If $selected_id
    // is empty, an empty form is shown, with only an 'Add New'
    // button displayed.
    global $Translation;
    // mm: get table permissions
    $arrPerm = getTablePermissions('outcomes');
    if (!$arrPerm[1] && $selected_id == '') {
        return '';
    }
    // print preview?
    $dvprint = false;
    if ($selected_id && $_REQUEST['dvprint_x'] != '') {
        $dvprint = true;
    }
    $filterer_outcome_area = thisOr(undo_magic_quotes($_REQUEST['filterer_outcome_area']), '');
    // populate filterers, starting from children to grand-parents
    // unique random identifier
    $rnd1 = $dvprint ? rand(1000000, 9999999) : '';
    // combobox: outcome_area
    $combo_outcome_area = new DataCombo();
    // combobox: strata
    $combo_strata = new Combo();
    $combo_strata->ListType = 0;
    $combo_strata->MultipleSeparator = ', ';
    $combo_strata->ListBoxHeight = 10;
    $combo_strata->RadiosPerLine = 1;
    if (is_file(dirname(__FILE__) . '/hooks/outcomes.strata.csv')) {
        $strata_data = addslashes(implode('', @file(dirname(__FILE__) . '/hooks/outcomes.strata.csv')));
        $combo_strata->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions($strata_data)));
        $combo_strata->ListData = $combo_strata->ListItem;
    } else {
        $combo_strata->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions("Individuals;;Community, Sector & Society")));
        $combo_strata->ListData = $combo_strata->ListItem;
    }
    $combo_strata->SelectName = 'strata';
    if ($selected_id) {
        // mm: check member permissions
        if (!$arrPerm[2]) {
            return "";
        }
        // mm: who is the owner?
        $ownerGroupID = sqlValue("select groupID from membership_userrecords where tableName='outcomes' and pkValue='" . makeSafe($selected_id) . "'");
        $ownerMemberID = sqlValue("select lcase(memberID) from membership_userrecords where tableName='outcomes' and pkValue='" . makeSafe($selected_id) . "'");
        if ($arrPerm[2] == 1 && getLoggedMemberID() != $ownerMemberID) {
            return "";
        }
        if ($arrPerm[2] == 2 && getLoggedGroupID() != $ownerGroupID) {
            return "";
        }
        // can edit?
        if ($arrPerm[3] == 1 && $ownerMemberID == getLoggedMemberID() || $arrPerm[3] == 2 && $ownerGroupID == getLoggedGroupID() || $arrPerm[3] == 3) {
            $AllowUpdate = 1;
        } else {
            $AllowUpdate = 0;
        }
        $res = sql("select * from `outcomes` where `outcome_id`='" . makeSafe($selected_id) . "'", $eo);
        $row = mysql_fetch_array($res);
        $urow = $row;
        /* unsanitized data */
        $hc = new CI_Input();
        $row = $hc->xss_clean($row);
        /* sanitize data */
        $combo_outcome_area->SelectedData = $row['outcome_area'];
        $combo_strata->SelectedData = $row['strata'];
    } else {
        $combo_outcome_area->SelectedData = $filterer_outcome_area;
        $combo_strata->SelectedText = $_REQUEST['FilterField'][1] == '4' && $_REQUEST['FilterOperator'][1] == '<=>' ? get_magic_quotes_gpc() ? stripslashes($_REQUEST['FilterValue'][1]) : $_REQUEST['FilterValue'][1] : "";
    }
    $combo_outcome_area->HTML = $combo_outcome_area->MatchText = '<span id="outcome_area-container' . $rnd1 . '"></span><input type="hidden" name="outcome_area" id="outcome_area' . $rnd1 . '">';
    $combo_strata->Render();
    ob_start();
    ?>

	<script>
		// initial lookup values
		var current_outcome_area__RAND__ = { text: "", value: "<?php 
    echo addslashes($selected_id ? $urow['outcome_area'] : $filterer_outcome_area);
    ?>
"};
		
		jQuery(function() {
			outcome_area_reload__RAND__();
		});
		function outcome_area_reload__RAND__(){
		<?php 
    if (($AllowUpdate || $AllowInsert) && !$dvprint) {
        ?>

			jQuery("#outcome_area-container__RAND__").select2({
				/* initial default value */
				initSelection: function(e, c){
					jQuery.ajax({
						url: 'ajax_combo.php',
						dataType: 'json',
						data: { id: current_outcome_area__RAND__.value, t: 'outcomes', f: 'outcome_area' }
					}).done(function(resp){
						c({
//.........这里部分代码省略.........
开发者ID:centaurustech,项目名称:git-SID,代码行数:101,代码来源:outcomes_dml.php

示例14: dirname

<?php

// This script and data application were generated by AppGini 5.50
// Download AppGini for free from http://bigprof.com/appgini/download/
$currDir = dirname(__FILE__);
include "{$currDir}/defaultLang.php";
include "{$currDir}/language.php";
include "{$currDir}/lib.php";
@(include "{$currDir}/hooks/submitlog.php");
include "{$currDir}/submitlog_dml.php";
// mm: can the current member access this page?
$perm = getTablePermissions('submitlog');
if (!$perm[0]) {
    echo error_message($Translation['tableAccessDenied'], false);
    echo '<script>setTimeout("window.location=\'index.php?signOut=1\'", 2000);</script>';
    exit;
}
$x = new DataList();
$x->TableName = "submitlog";
// Fields that can be displayed in the table view
$x->QueryFieldsTV = array("`submitlog`.`submid`" => "submid", "concat('<img src=\"', if(`submitlog`.`cstatus`, 'checked.gif', 'checkednot.gif'), '\" border=\"0\" />')" => "cstatus", "DATE_FORMAT(`submitlog`.`logtime`, '%c/%e/%Y %l:%i%p')" => "logtime", "`submitlog`.`ipaddr`" => "ipaddr", "`submitlog`.`company`" => "company", "`submitlog`.`country`" => "country", "`submitlog`.`website`" => "website", "`submitlog`.`contactname`" => "contactname", "`submitlog`.`email`" => "email", "`submitlog`.`title`" => "title", "`submitlog`.`version`" => "version", "if(`submitlog`.`pdate`,date_format(`submitlog`.`pdate`,'%m/%d/%Y'),'')" => "pdate", "`submitlog`.`cost`" => "cost", "`submitlog`.`ptype`" => "ptype", "`submitlog`.`install`" => "install", "`submitlog`.`os`" => "os", "`submitlog`.`languages`" => "languages", "`submitlog`.`changeinfo`" => "changeinfo", "`submitlog`.`category`" => "category", "`submitlog`.`requirements`" => "requirements", "`submitlog`.`ksize`" => "ksize", "`submitlog`.`keywords`" => "keywords", "`submitlog`.`description`" => "description", "`submitlog`.`descrlarge`" => "descrlarge", "`submitlog`.`homepage`" => "homepage", "`submitlog`.`screenshot`" => "screenshot", "`submitlog`.`icon`" => "icon", "`submitlog`.`padfile`" => "padfile", "`submitlog`.`download`" => "download", "`submitlog`.`aspnumber`" => "aspnumber", "`submitlog`.`backlink`" => "backlink", "`submitlog`.`affiliate`" => "affiliate", "`submitlog`.`affiliateid`" => "affiliateid");
// mapping incoming sort by requests to actual query fields
$x->SortFields = array(1 => '`submitlog`.`submid`', 2 => '`submitlog`.`cstatus`', 3 => '`submitlog`.`logtime`', 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => '`submitlog`.`pdate`', 13 => '`submitlog`.`cost`', 14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20, 21 => '`submitlog`.`ksize`', 22 => 22, 23 => 23, 24 => 24, 25 => 25, 26 => 26, 27 => 27, 28 => 28, 29 => 29, 30 => 30, 31 => 31, 32 => 32, 33 => 33);
// Fields that can be displayed in the csv file
$x->QueryFieldsCSV = array("`submitlog`.`submid`" => "submid", "`submitlog`.`cstatus`" => "cstatus", "DATE_FORMAT(`submitlog`.`logtime`, '%c/%e/%Y %l:%i%p')" => "logtime", "`submitlog`.`ipaddr`" => "ipaddr", "`submitlog`.`company`" => "company", "`submitlog`.`country`" => "country", "`submitlog`.`website`" => "website", "`submitlog`.`contactname`" => "contactname", "`submitlog`.`email`" => "email", "`submitlog`.`title`" => "title", "`submitlog`.`version`" => "version", "if(`submitlog`.`pdate`,date_format(`submitlog`.`pdate`,'%m/%d/%Y'),'')" => "pdate", "`submitlog`.`cost`" => "cost", "`submitlog`.`ptype`" => "ptype", "`submitlog`.`install`" => "install", "`submitlog`.`os`" => "os", "`submitlog`.`languages`" => "languages", "`submitlog`.`changeinfo`" => "changeinfo", "`submitlog`.`category`" => "category", "`submitlog`.`requirements`" => "requirements", "`submitlog`.`ksize`" => "ksize", "`submitlog`.`keywords`" => "keywords", "`submitlog`.`description`" => "description", "`submitlog`.`descrlarge`" => "descrlarge", "`submitlog`.`homepage`" => "homepage", "`submitlog`.`screenshot`" => "screenshot", "`submitlog`.`icon`" => "icon", "`submitlog`.`padfile`" => "padfile", "`submitlog`.`download`" => "download", "`submitlog`.`aspnumber`" => "aspnumber", "`submitlog`.`backlink`" => "backlink", "`submitlog`.`affiliate`" => "affiliate", "`submitlog`.`affiliateid`" => "affiliateid");
// Fields that can be filtered
$x->QueryFieldsFilters = array("`submitlog`.`submid`" => "No", "`submitlog`.`cstatus`" => "Status", "`submitlog`.`logtime`" => "Submission Date", "`submitlog`.`ipaddr`" => "IP", "`submitlog`.`company`" => "Company Name", "`submitlog`.`country`" => "Country", "`submitlog`.`website`" => "website", "`submitlog`.`contactname`" => "contactname", "`submitlog`.`email`" => "email", "`submitlog`.`title`" => "Title", "`submitlog`.`version`" => "Version", "`submitlog`.`pdate`" => "pdate", "`submitlog`.`cost`" => "cost", "`submitlog`.`ptype`" => "ptype", "`submitlog`.`install`" => "install", "`submitlog`.`os`" => "os", "`submitlog`.`languages`" => "languages", "`submitlog`.`changeinfo`" => "changeinfo", "`submitlog`.`category`" => "category", "`submitlog`.`requirements`" => "requirements", "`submitlog`.`ksize`" => "ksize", "`submitlog`.`keywords`" => "keywords", "`submitlog`.`description`" => "description", "`submitlog`.`descrlarge`" => "descrlarge", "`submitlog`.`homepage`" => "homepage", "`submitlog`.`icon`" => "icon", "`submitlog`.`padfile`" => "PAD file", "`submitlog`.`download`" => "Download", "`submitlog`.`aspnumber`" => "aspnumber", "`submitlog`.`backlink`" => "Backlink URL", "`submitlog`.`affiliate`" => "Affiliate", "`submitlog`.`affiliateid`" => "Affiliate Data");
// Fields that can be quick searched
$x->QueryFieldsQS = array("`submitlog`.`submid`" => "submid", "concat('<img src=\"', if(`submitlog`.`cstatus`, 'checked.gif', 'checkednot.gif'), '\" border=\"0\" />')" => "cstatus", "DATE_FORMAT(`submitlog`.`logtime`, '%c/%e/%Y %l:%i%p')" => "logtime", "`submitlog`.`ipaddr`" => "ipaddr", "`submitlog`.`company`" => "company", "`submitlog`.`country`" => "country", "`submitlog`.`website`" => "website", "`submitlog`.`contactname`" => "contactname", "`submitlog`.`email`" => "email", "`submitlog`.`title`" => "title", "`submitlog`.`version`" => "version", "if(`submitlog`.`pdate`,date_format(`submitlog`.`pdate`,'%m/%d/%Y'),'')" => "pdate", "`submitlog`.`cost`" => "cost", "`submitlog`.`ptype`" => "ptype", "`submitlog`.`install`" => "install", "`submitlog`.`os`" => "os", "`submitlog`.`languages`" => "languages", "`submitlog`.`changeinfo`" => "changeinfo", "`submitlog`.`category`" => "category", "`submitlog`.`requirements`" => "requirements", "`submitlog`.`ksize`" => "ksize", "`submitlog`.`keywords`" => "keywords", "`submitlog`.`description`" => "description", "`submitlog`.`descrlarge`" => "descrlarge", "`submitlog`.`homepage`" => "homepage", "`submitlog`.`icon`" => "icon", "`submitlog`.`padfile`" => "padfile", "`submitlog`.`download`" => "download", "`submitlog`.`aspnumber`" => "aspnumber", "`submitlog`.`backlink`" => "backlink", "`submitlog`.`affiliate`" => "affiliate", "`submitlog`.`affiliateid`" => "affiliateid");
// Lookup fields that can be used as filterers
$x->filterers = array();
开发者ID:WebxOne,项目名称:swldbav0.6,代码行数:31,代码来源:submitlog_view.php

示例15: outcome_areas_form

function outcome_areas_form($selected_id = '', $AllowUpdate = 1, $AllowInsert = 1, $AllowDelete = 1, $ShowCancel = 0)
{
    // function to return an editable form for a table records
    // and fill it with data of record whose ID is $selected_id. If $selected_id
    // is empty, an empty form is shown, with only an 'Add New'
    // button displayed.
    global $Translation;
    // mm: get table permissions
    $arrPerm = getTablePermissions('outcome_areas');
    if (!$arrPerm[1] && $selected_id == '') {
        return '';
    }
    // print preview?
    $dvprint = false;
    if ($selected_id && $_REQUEST['dvprint_x'] != '') {
        $dvprint = true;
    }
    // populate filterers, starting from children to grand-parents
    // unique random identifier
    $rnd1 = $dvprint ? rand(1000000, 9999999) : '';
    if ($selected_id) {
        // mm: check member permissions
        if (!$arrPerm[2]) {
            return "";
        }
        // mm: who is the owner?
        $ownerGroupID = sqlValue("select groupID from membership_userrecords where tableName='outcome_areas' and pkValue='" . makeSafe($selected_id) . "'");
        $ownerMemberID = sqlValue("select lcase(memberID) from membership_userrecords where tableName='outcome_areas' and pkValue='" . makeSafe($selected_id) . "'");
        if ($arrPerm[2] == 1 && getLoggedMemberID() != $ownerMemberID) {
            return "";
        }
        if ($arrPerm[2] == 2 && getLoggedGroupID() != $ownerGroupID) {
            return "";
        }
        // can edit?
        if ($arrPerm[3] == 1 && $ownerMemberID == getLoggedMemberID() || $arrPerm[3] == 2 && $ownerGroupID == getLoggedGroupID() || $arrPerm[3] == 3) {
            $AllowUpdate = 1;
        } else {
            $AllowUpdate = 0;
        }
        $res = sql("select * from `outcome_areas` where `outcome_area_id`='" . makeSafe($selected_id) . "'", $eo);
        $row = mysql_fetch_array($res);
        $urow = $row;
        /* unsanitized data */
        $hc = new CI_Input();
        $row = $hc->xss_clean($row);
        /* sanitize data */
    } else {
    }
    ob_start();
    ?>

	<script>
		// initial lookup values
		
		jQuery(function() {
		});
	</script>
	<?php 
    $lookups = str_replace('__RAND__', $rnd1, ob_get_contents());
    ob_end_clean();
    // code for template based detail view forms
    // open the detail view template
    if ($dvprint) {
        $templateCode = @file_get_contents('./templates/outcome_areas_templateDVP.html');
    } else {
        $templateCode = @file_get_contents('./templates/outcome_areas_templateDV.html');
    }
    // process form title
    $templateCode = str_replace('<%%DETAIL_VIEW_TITLE%%>', 'Outcome area details', $templateCode);
    $templateCode = str_replace('<%%RND1%%>', $rnd1, $templateCode);
    // process buttons
    if ($arrPerm[1]) {
        // allow insert?
        if (!$selected_id) {
            $templateCode = str_replace('<%%INSERT_BUTTON%%>', '<button tabindex="2" type="submit" class="btn btn-success" id="insert" name="insert_x" value="1" onclick="return outcome_areas_validateData();"><i class="glyphicon glyphicon-plus-sign"></i> ' . $Translation['Save New'] . '</button>', $templateCode);
        }
        $templateCode = str_replace('<%%INSERT_BUTTON%%>', '<button tabindex="2" type="submit" class="btn btn-default" id="insert" name="insert_x" value="1" onclick="return outcome_areas_validateData();"><i class="glyphicon glyphicon-plus-sign"></i> ' . $Translation['Save As Copy'] . '</button>', $templateCode);
    } else {
        $templateCode = str_replace('<%%INSERT_BUTTON%%>', '', $templateCode);
    }
    // 'Back' button action
    if ($_REQUEST['Embedded']) {
        $backAction = 'window.parent.jQuery(\'.modal\').modal(\'hide\'); return false;';
    } else {
        $backAction = '$$(\'form\')[0].writeAttribute(\'novalidate\', \'novalidate\'); document.myform.reset(); return true;';
    }
    if ($selected_id) {
        if (!$_REQUEST['Embedded']) {
            $templateCode = str_replace('<%%DVPRINT_BUTTON%%>', '<button tabindex="2" type="submit" class="btn btn-default" id="dvprint" name="dvprint_x" value="1" onclick="$$(\'form\')[0].writeAttribute(\'novalidate\', \'novalidate\'); document.myform.reset(); return true;"><i class="glyphicon glyphicon-print"></i> ' . $Translation['Print Preview'] . '</button>', $templateCode);
        }
        if ($AllowUpdate) {
            $templateCode = str_replace('<%%UPDATE_BUTTON%%>', '<button tabindex="2" type="submit" class="btn btn-success btn-lg" id="update" name="update_x" value="1" onclick="return outcome_areas_validateData();"><i class="glyphicon glyphicon-ok"></i> ' . $Translation['Save Changes'] . '</button>', $templateCode);
        } else {
            $templateCode = str_replace('<%%UPDATE_BUTTON%%>', '', $templateCode);
        }
        if ($arrPerm[4] == 1 && $ownerMemberID == getLoggedMemberID() || $arrPerm[4] == 2 && $ownerGroupID == getLoggedGroupID() || $arrPerm[4] == 3) {
            // allow delete?
            $templateCode = str_replace('<%%DELETE_BUTTON%%>', '<button tabindex="2" type="submit" class="btn btn-danger" id="delete" name="delete_x" value="1" onclick="return confirm(\'' . $Translation['are you sure?'] . '\');"><i class="glyphicon glyphicon-trash"></i> ' . $Translation['Delete'] . '</button>', $templateCode);
        } else {
//.........这里部分代码省略.........
开发者ID:centaurustech,项目名称:git-SID,代码行数:101,代码来源:outcome_areas_dml.php


注:本文中的getTablePermissions函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。