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


PHP constructArray函数代码示例

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


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

示例1: createModuleMetaFile

 static function createModuleMetaFile()
 {
     $adb = PearDatabase::getInstance();
     $sql = "select * from vtiger_tab";
     $result = $adb->pquery($sql, array());
     $num_rows = $adb->num_rows($result);
     $result_array = array();
     $seq_array = array();
     $ownedby_array = array();
     for ($i = 0; $i < $num_rows; $i++) {
         $tabid = $adb->query_result($result, $i, 'tabid');
         $tabname = $adb->query_result($result, $i, 'name');
         $presence = $adb->query_result($result, $i, 'presence');
         $ownedby = $adb->query_result($result, $i, 'ownedby');
         $result_array[$tabname] = $tabid;
         $seq_array[$tabid] = $presence;
         $ownedby_array[$tabid] = $ownedby;
     }
     //Constructing the actionname=>actionid array
     $actionid_array = array();
     $sql1 = "select * from vtiger_actionmapping";
     $result1 = $adb->pquery($sql1, array());
     $num_seq1 = $adb->num_rows($result1);
     for ($i = 0; $i < $num_seq1; $i++) {
         $actionname = $adb->query_result($result1, $i, 'actionname');
         $actionid = $adb->query_result($result1, $i, 'actionid');
         $actionid_array[$actionname] = $actionid;
     }
     //Constructing the actionid=>actionname array with securitycheck=0
     $actionname_array = array();
     $sql2 = "select * from vtiger_actionmapping where securitycheck=0";
     $result2 = $adb->pquery($sql2, array());
     $num_seq2 = $adb->num_rows($result2);
     for ($i = 0; $i < $num_seq2; $i++) {
         $actionname = $adb->query_result($result2, $i, 'actionname');
         $actionid = $adb->query_result($result2, $i, 'actionid');
         $actionname_array[$actionid] = $actionname;
     }
     $filename = 'user_privileges/tabdata.php';
     if (file_exists($filename)) {
         if (is_writable($filename)) {
             if (!($handle = fopen($filename, 'w+'))) {
                 echo "Cannot open file ({$filename})";
                 exit;
             }
             require_once 'modules/Users/CreateUserPrivilegeFile.php';
             $newbuf = '';
             $newbuf .= "<?php\n\n";
             $newbuf .= "\n";
             $newbuf .= "//This file contains the commonly used variables \n";
             $newbuf .= "\n";
             $newbuf .= "\$tab_info_array=" . constructArray($result_array) . ";\n";
             $newbuf .= "\n";
             $newbuf .= "\$tab_seq_array=" . constructArray($seq_array) . ";\n";
             $newbuf .= "\n";
             $newbuf .= "\$tab_ownedby_array=" . constructArray($ownedby_array) . ";\n";
             $newbuf .= "\n";
             $newbuf .= "\$action_id_array=" . constructSingleStringKeyAndValueArray($actionid_array) . ";\n";
             $newbuf .= "\n";
             $newbuf .= "\$action_name_array=" . constructSingleStringValueArray($actionname_array) . ";\n";
             $newbuf .= "?>";
             fputs($handle, $newbuf);
             fclose($handle);
         } else {
             echo "The file {$filename} is not writable";
         }
     } else {
         echo "The file {$filename} does not exist";
     }
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:70,代码来源:Deprecated.php

示例2: createUserSharingPrivilegesfile

/** Creates a file with all the organization default sharing permissions and custom sharing permissins specific for the specified user. In this file the information of the other users whose data is shared with the specified user is stored.   
 * @param $userid -- user id:: Type integer
 * @returns sharing_privileges_userid file under the user_privileges directory
 */
function createUserSharingPrivilegesfile($userid)
{
    global $adb, $root_directory;
    checkFileAccessForInclusion('user_privileges/user_privileges_' . $userid . '.php');
    require 'user_privileges/user_privileges_' . $userid . '.php';
    $handle = @fopen($root_directory . 'user_privileges/sharing_privileges_' . $userid . '.php', "w+");
    if ($handle) {
        $newbuf = '';
        $newbuf .= "<?php\n\n";
        $newbuf .= "\n";
        $newbuf .= "//This is the sharing access privilege file\n";
        $user_focus = new Users();
        $user_focus->retrieve_entity_info($userid, "Users");
        if ($user_focus->is_admin == 'on') {
            $newbuf .= "\n";
            $newbuf .= "?>";
            fputs($handle, $newbuf);
            fclose($handle);
            return;
        } else {
            //Constructig the Default Org Share Array
            $def_org_share = getAllDefaultSharingAction();
            $newbuf .= "\$defaultOrgSharingPermission=" . constructArray($def_org_share) . ";\n";
            $newbuf .= "\n";
            //Constructing the Related Module Sharing Array
            $relModSharArr = array();
            $query = "select * from vtiger_datashare_relatedmodules";
            $result = $adb->pquery($query, array());
            $num_rows = $adb->num_rows($result);
            for ($i = 0; $i < $num_rows; $i++) {
                $parTabId = $adb->query_result($result, $i, 'tabid');
                $relTabId = $adb->query_result($result, $i, 'relatedto_tabid');
                if (is_array($relModSharArr[$relTabId])) {
                    $temArr = $relModSharArr[$relTabId];
                    $temArr[] = $parTabId;
                } else {
                    $temArr = array();
                    $temArr[] = $parTabId;
                }
                $relModSharArr[$relTabId] = $temArr;
            }
            $newbuf .= "\$related_module_share=" . constructTwoDimensionalValueArray($relModSharArr) . ";\n\n";
            //Constructing Lead Sharing Rules
            $lead_share_per_array = getUserModuleSharingObjects("Leads", $userid, $def_org_share, $current_user_roles, $parent_roles, $current_user_groups);
            $lead_share_read_per = $lead_share_per_array['read'];
            $lead_share_write_per = $lead_share_per_array['write'];
            $lead_sharingrule_members = $lead_share_per_array['sharingrules'];
            $newbuf .= "\$Leads_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($lead_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($lead_share_read_per['GROUP']) . ");\n\n";
            $newbuf .= "\$Leads_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($lead_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($lead_share_write_per['GROUP']) . ");\n\n";
            //Constructing the Lead Email Related Module Sharing Array
            $lead_related_email = getRelatedModuleSharingArray("Leads", "Emails", $lead_sharingrule_members, $lead_share_read_per, $lead_share_write_per, $def_org_share);
            $lead_email_share_read_per = $lead_related_email['read'];
            $lead_email_share_write_per = $lead_related_email['write'];
            $newbuf .= "\$Leads_Emails_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($lead_email_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($lead_email_share_read_per['GROUP']) . ");\n\n";
            $newbuf .= "\$Leads_Emails_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($lead_email_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($lead_email_share_write_per['GROUP']) . ");\n\n";
            //Constructing Account Sharing Rules
            $account_share_per_array = getUserModuleSharingObjects("Accounts", $userid, $def_org_share, $current_user_roles, $parent_roles, $current_user_groups);
            $account_share_read_per = $account_share_per_array['read'];
            $account_share_write_per = $account_share_per_array['write'];
            $account_sharingrule_members = $account_share_per_array['sharingrules'];
            /*echo '<pre>';
            		print_r($account_share_read_per['GROUP']);
            		echo '</pre>';*/
            $newbuf .= "\$Accounts_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($account_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($account_share_read_per['GROUP']) . ");\n\n";
            $newbuf .= "\$Accounts_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($account_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($account_share_write_per['GROUP']) . ");\n\n";
            //Constructing Contact Sharing Rules
            $newbuf .= "\$Contacts_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($account_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($account_share_read_per['GROUP']) . ");\n\n";
            $newbuf .= "\$Contacts_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($account_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($account_share_write_per['GROUP']) . ");\n\n";
            //Constructing the Account Potential Related Module Sharing Array
            $acct_related_pot = getRelatedModuleSharingArray("Accounts", "Potentials", $account_sharingrule_members, $account_share_read_per, $account_share_write_per, $def_org_share);
            $acc_pot_share_read_per = $acct_related_pot['read'];
            $acc_pot_share_write_per = $acct_related_pot['write'];
            $newbuf .= "\$Accounts_Potentials_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_pot_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_pot_share_read_per['GROUP']) . ");\n\n";
            $newbuf .= "\$Accounts_Potentials_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_pot_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_pot_share_write_per['GROUP']) . ");\n\n";
            //Constructing the Account Ticket Related Module Sharing Array
            $acct_related_tkt = getRelatedModuleSharingArray("Accounts", "HelpDesk", $account_sharingrule_members, $account_share_read_per, $account_share_write_per, $def_org_share);
            $acc_tkt_share_read_per = $acct_related_tkt['read'];
            $acc_tkt_share_write_per = $acct_related_tkt['write'];
            $newbuf .= "\$Accounts_HelpDesk_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_tkt_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_tkt_share_read_per['GROUP']) . ");\n\n";
            $newbuf .= "\$Accounts_HelpDesk_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_tkt_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_tkt_share_write_per['GROUP']) . ");\n\n";
            //Constructing the Account Email Related Module Sharing Array
            $acct_related_email = getRelatedModuleSharingArray("Accounts", "Emails", $account_sharingrule_members, $account_share_read_per, $account_share_write_per, $def_org_share);
            $acc_email_share_read_per = $acct_related_email['read'];
            $acc_email_share_write_per = $acct_related_email['write'];
            $newbuf .= "\$Accounts_Emails_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_email_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_email_share_read_per['GROUP']) . ");\n\n";
            $newbuf .= "\$Accounts_Emails_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_email_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_email_share_write_per['GROUP']) . ");\n\n";
            //Constructing the Account Quote Related Module Sharing Array
            $acct_related_qt = getRelatedModuleSharingArray("Accounts", "Quotes", $account_sharingrule_members, $account_share_read_per, $account_share_write_per, $def_org_share);
            $acc_qt_share_read_per = $acct_related_qt['read'];
            $acc_qt_share_write_per = $acct_related_qt['write'];
            $newbuf .= "\$Accounts_Quotes_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_qt_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_qt_share_read_per['GROUP']) . ");\n\n";
            $newbuf .= "\$Accounts_Quotes_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_qt_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_qt_share_write_per['GROUP']) . ");\n\n";
            //Constructing the Account SalesOrder Related Module Sharing Array
            $acct_related_so = getRelatedModuleSharingArray("Accounts", "SalesOrder", $account_sharingrule_members, $account_share_read_per, $account_share_write_per, $def_org_share);
            $acc_so_share_read_per = $acct_related_so['read'];
            $acc_so_share_write_per = $acct_related_so['write'];
//.........这里部分代码省略.........
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:101,代码来源:CreateUserPrivilegeFile.php

示例3: create_tab_data_file

/**
 * Function to write the tabid and name to a flat file vtiger_tabdata.txt so that the data
 * is obtained from the file instead of repeated queries
 * returns null
 */
function create_tab_data_file()
{
    global $log;
    $log->debug("Entering create_tab_data_file() method ...");
    $log->info("creating vtiger_tabdata file");
    global $adb;
    //$sql = "select * from vtiger_tab";
    // vtlib customization: Disabling the tab item based on presence
    $sql = "select * from vtiger_tab where presence in (0,2)";
    // END
    $result = $adb->pquery($sql, array());
    $num_rows = $adb->num_rows($result);
    $result_array = array();
    $seq_array = array();
    $ownedby_array = array();
    for ($i = 0; $i < $num_rows; $i++) {
        $tabid = $adb->query_result($result, $i, 'tabid');
        $tabname = $adb->query_result($result, $i, 'name');
        $presence = $adb->query_result($result, $i, 'presence');
        $ownedby = $adb->query_result($result, $i, 'ownedby');
        $result_array[$tabname] = $tabid;
        $seq_array[$tabid] = $presence;
        $ownedby_array[$tabid] = $ownedby;
    }
    //Constructing the actionname=>actionid array
    $actionid_array = array();
    $sql1 = "select * from vtiger_actionmapping";
    $result1 = $adb->pquery($sql1, array());
    $num_seq1 = $adb->num_rows($result1);
    for ($i = 0; $i < $num_seq1; $i++) {
        $actionname = $adb->query_result($result1, $i, 'actionname');
        $actionid = $adb->query_result($result1, $i, 'actionid');
        $actionid_array[$actionname] = $actionid;
    }
    //Constructing the actionid=>actionname array with securitycheck=0
    $actionname_array = array();
    $sql2 = "select * from vtiger_actionmapping where securitycheck=0";
    $result2 = $adb->pquery($sql2, array());
    $num_seq2 = $adb->num_rows($result2);
    for ($i = 0; $i < $num_seq2; $i++) {
        $actionname = $adb->query_result($result2, $i, 'actionname');
        $actionid = $adb->query_result($result2, $i, 'actionid');
        $actionname_array[$actionid] = $actionname;
    }
    $filename = 'tabdata.php';
    if (file_exists($filename)) {
        if (is_writable($filename)) {
            if (!($handle = fopen($filename, 'w+'))) {
                echo "Cannot open file ({$filename})";
                exit;
            }
            require_once 'modules/Users/CreateUserPrivilegeFile.php';
            $newbuf = '';
            $newbuf .= "<?php\n\n";
            $newbuf .= "\n";
            $newbuf .= "//This file contains the commonly used variables \n";
            $newbuf .= "\n";
            $newbuf .= "\$tab_info_array=" . constructArray($result_array) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$tab_seq_array=" . constructArray($seq_array) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$tab_ownedby_array=" . constructArray($ownedby_array) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$action_id_array=" . constructSingleStringKeyAndValueArray($actionid_array) . ";\n";
            $newbuf .= "\n";
            $newbuf .= "\$action_name_array=" . constructSingleStringValueArray($actionname_array) . ";\n";
            $newbuf .= "?>";
            fputs($handle, $newbuf);
            fclose($handle);
        } else {
            echo "The file {$filename} is not writable";
        }
    } else {
        echo "The file {$filename} does not exist";
        $log->debug("Exiting create_tab_data_file method ...");
        return;
    }
}
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:83,代码来源:CommonUtils.php


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