本文整理汇总了PHP中arrayMerge函数的典型用法代码示例。如果您正苦于以下问题:PHP arrayMerge函数的具体用法?PHP arrayMerge怎么用?PHP arrayMerge使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了arrayMerge函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testArrayMerge
public function testArrayMerge()
{
$array1 = array('a', 'b', 'c', 4 => 'd', 5 => 'e');
$array2 = array('z', 6 => 'y', 7 => 'x', 4 => 'w', 5 => 'v');
$newArray = arrayMerge($array1, $array2);
$this->assertEquals('b', $newArray[1]);
// Tests no overwrite
$this->assertEquals('w', $newArray[4]);
// Tests explicit overwrite
$this->assertEquals('z', $newArray[0]);
// Tests conincidental overwrite
}
示例2: load
/**
* Merges configurations from all the loaded files.
* @param string $group
* @param array $config
* @return Config_Reader
*/
public function load($group, array $config = NULL)
{
if ($files = Exido::findFile($this->_directory, $group)) {
// Set config array
$config = array();
foreach ($files as $file) {
// Merge each config array to the global array
$config = arrayMerge($config, require $file);
}
}
return parent::load($group, $config);
}
示例3: getFolderSelectList
function getFolderSelectList()
{
global $AppUI;
$folders = array(0 => '');
$q = new DBQuery();
$q->addTable('file_folders');
$q->addQuery('file_folder_id, file_folder_name, file_folder_parent');
$q->addOrder('file_folder_name');
$sql = $q->prepare();
// $sql = "SELECT file_folder_id, file_folder_name, file_folder_parent FROM file_folders";
$vfolders = arrayMerge(array('0' => array(0, $AppUI->_('Root'), -1)), db_loadHashList($sql, 'file_folder_id'));
$folders = array_filter($vfolders, "check_perm");
return $folders;
}
示例4: _createCompanySelection
protected function _createCompanySelection($AppUI, $companyInput)
{
$company = new CCompany();
$companyMatches = $company->getCompanyList($AppUI, -1, $companyInput);
$company_id = count($companyMatches) == 1 ? $companyMatches[0]['company_id'] : $AppUI->user_company;
$companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$companies = arrayMerge(array('0' => ''), $companies);
$output .= '<td>' . arraySelect($companies, 'company_id', ' onChange=this.form.new_company.value=\'\'', $company_id) . '<input type="text" name="new_company" value="' . ($company_id > 0 ? '' : $companyInput) . '" />';
if ($company_id == 0) {
$output .= '<br /><em>' . $AppUI->_('compinfo') . '</em>';
}
$output .= '</td></tr>';
return $output;
}
示例5: arrayMerge
/**
* Taken from CakePHP!
* This function can be thought of as a hybrid between PHP's array_merge and array_merge_recursive. The difference
* to the two is that if an array key contains another array then the function behaves recursive (unlike array_merge)
* but does not do if for keys containing strings (unlike array_merge_recursive). See the unit test for more information.
*
* Note: This function will work with an unlimited amount of arguments and typecasts non-array parameters into arrays.
*
* @param array $arr1 Array to be merged
* @param array $arr2 Array to merge with
*
* @return array Merged array
*/
function arrayMerge($arr1, $arr2 = null)
{
$args = func_get_args();
if (!isset($r)) {
$r = (array) current($args);
}
while (($arg = next($args)) !== false) {
foreach ((array) $arg as $key => $val) {
if (is_array($val) && isset($r[$key]) && is_array($r[$key])) {
$r[$key] = arrayMerge($r[$key], $val);
} elseif (is_int($key)) {
$r[] = $val;
} else {
$r[$key] = $val;
}
}
}
return $r;
}
示例6: die
/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
global $AppUI, $company_id, $dept_ids, $department, $locale_char_set, $proFilter, $projectStatus, $showInactive, $showLabels, $showAllGantt, $user_id, $w2Pconfig, $project_id, $project_original_id;
w2PsetExecutionConditions($w2Pconfig);
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
$projectStatus = w2PgetSysVal('ProjectStatus');
$projectStatus = arrayMerge(array('-2' => $AppUI->_('All w/o in progress')), $projectStatus);
$user_id = w2PgetParam($_REQUEST, 'user_id', $AppUI->user_id);
if ($AppUI->user_id == $user_id) {
$projectStatus = arrayMerge(array('-3' => $AppUI->_('My projects')), $projectStatus);
} else {
$projectStatus = arrayMerge(array('-3' => $AppUI->_('User\'s projects')), $projectStatus);
}
$proFilter = w2PgetParam($_REQUEST, 'proFilter', '0');
$company_id = w2PgetParam($_REQUEST, 'company_id', 0);
$department = w2PgetParam($_REQUEST, 'department', 0);
$showLabels = w2PgetParam($_REQUEST, 'showLabels', 1);
$showInactive = w2PgetParam($_REQUEST, 'showInactive', 1);
$original_project_id = w2PgetParam($_REQUEST, 'original_project_id', 1);
$pjobj = new CProject();
$working_hours = $w2Pconfig['daily_working_hours'];
// pull valid projects and their percent complete information
// GJB: Note that we have to special case duration type 24 and this refers to the hours in a day, NOT 24 hours
$q = new w2p_Database_Query();
$q->addTable('projects', 'pr');
$q->addQuery('DISTINCT pr.project_id, project_color_identifier, project_name, project_start_date, project_end_date,
max(t1.task_end_date) AS project_actual_end_date, project_percent_complete, project_status, project_active');
示例7: die
/* $Id: departments_tab.view.projects.php 1863 2011-05-01 00:25:07Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/projects/departments_tab.view.projects.php $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
global $a, $addPwOiD, $buffer, $dept_id, $department, $min_view, $m, $priority, $projects, $tab, $user_id, $orderdir, $orderby;
$perms =& $AppUI->acl();
$df = $AppUI->getPref('SHDATEFORMAT');
$pstatus = w2PgetSysVal('ProjectStatus');
if (isset($_POST['proFilter'])) {
$AppUI->setState('DeptProjectIdxFilter', $_POST['proFilter']);
}
$proFilter = $AppUI->getState('DeptProjectIdxFilter') !== null ? $AppUI->getState('DeptProjectIdxFilter') : '-1';
$projFilter = arrayMerge(array('-1' => 'All Projects'), $pstatus);
$projFilter = arrayMerge(array('-2' => 'All w/o in progress'), $projFilter);
$projFilter = arrayMerge(array('-3' => 'All w/o archived'), $projFilter);
natsort($projFilter);
// retrieve any state parameters
if (isset($_GET['tab'])) {
$AppUI->setState('DeptProjIdxTab', w2PgetParam($_GET, 'tab', null));
}
if (isset($_GET['orderby'])) {
$orderdir = $AppUI->getState('DeptProjIdxOrderDir') ? $AppUI->getState('DeptProjIdxOrderDir') == 'asc' ? 'desc' : 'asc' : 'desc';
$AppUI->setState('DeptProjIdxOrderBy', w2PgetParam($_GET, 'orderby', null));
$AppUI->setState('DeptProjIdxOrderDir', $orderdir);
}
$orderby = $AppUI->getState('DeptProjIdxOrderBy') ? $AppUI->getState('DeptProjIdxOrderBy') : 'project_end_date';
$orderdir = $AppUI->getState('DeptProjIdxOrderDir') ? $AppUI->getState('DeptProjIdxOrderDir') : 'asc';
if (isset($_POST['show_form'])) {
$AppUI->setState('addProjWithOwnerInDep', w2PgetParam($_POST, 'add_pwoid', 0));
}
示例8: die
<?php
/* TASKS $Id: gantt2.php 5766 2008-07-09 19:54:52Z merlinyoda $ */
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly.');
}
include $AppUI->getLibraryClass('jpgraph/src/jpgraph');
include $AppUI->getLibraryClass('jpgraph/src/jpgraph_gantt');
global $company_id, $dept_ids, $department, $locale_char_set, $proFilter, $projectStatus, $showInactive, $showLabels, $showAllGantt;
// $showAllGantt == Gantt with tasks and users
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
$filter1 = array();
$projectStatus = dPgetSysVal('ProjectStatus');
$projectStatus = arrayMerge(array('-2' => $AppUI->_('All w/o in progress')), $projectStatus);
$proFilter = dPgetParam($_REQUEST, 'proFilter', '-1');
if ($proFilter == '-2') {
$filter1[] = ' project_status != 3';
} else {
if ($proFilter != '-1') {
$filter1[] = ' project_status = ' . $proFilter;
}
}
if ($company_id != 0) {
$filter1[] = ' project_company = ' . $company_id;
}
if ($showInactive != '1') {
$filter1[] = ' project_status <> 7';
}
$pjobj =& new CProject();
$allowed_projects = $pjobj->getAllowedSQL($AppUI->user_id);
示例9: dPgetCleanParam
$log_start_date = dPgetCleanParam($_POST, 'log_start_date', 0);
$log_end_date = dPgetCleanParam($_POST, 'log_end_date', 0);
$log_all = (bool) dPgetParam($_POST, 'log_all', true);
$use_period = (int) dPgetParam($_POST, 'use_period', 0);
$show_orphaned = (int) dPgetParam($_POST, 'show_orphaned', 0);
$display_week_hours = (int) dPgetParam($_POST, 'display_week_hours', 0);
$max_levels = dPgetCleanParam($_POST, 'max_levels', '');
$log_userfilter = (int) dPgetParam($_POST, 'log_userfilter', 0);
$company_id = dPgetCleanParam($_POST, 'company_id', 'all');
$project_id = dPgetCleanParam($_POST, 'project_id', 'all');
require_once $AppUI->getModuleClass('projects');
require_once $AppUI->getModuleClass('tasks');
$proj = new CProject();
// filtering by companies
$projects = $proj->getAllowedRecords($AppUI->user_id, 'project_id,project_name', 'project_name');
$projFilter = arrayMerge(array('all' => $AppUI->_('All Projects')), $projects);
$durnTypes = dPgetSysVal('TaskDurationType');
$taskPriority = dPgetSysVal('TaskPriority');
// create Date objects from the datetime fields
$start_date = intval($log_start_date) ? new CDate($log_start_date) : new CDate();
$end_date = intval($log_end_date) ? new CDate($log_end_date) : new CDate();
$now = new CDate();
if (!$log_start_date) {
$start_date->subtractSpan(new Date_Span('14,0,0,0'));
}
$end_date->setTime(23, 59, 59);
?>
<script language="javascript">
var calendarField = '';
示例10: die
<?php
/* SYSKEYS $Id$ */
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly.');
}
$AppUI->savePlace();
// pull all the key types
$sql = "SELECT syskey_id,syskey_name FROM syskeys ORDER BY syskey_name";
$keys = arrayMerge(array(0 => '- Select Type -'), db_loadHashList($sql));
$sql = "SELECT * FROM syskeys, sysvals WHERE sysval_key_id = syskey_id ORDER BY sysval_title";
$values = db_loadList($sql);
$sysval_id = isset($_GET['sysval_id']) ? $_GET['sysval_id'] : 0;
$titleBlock = new CTitleBlock('System Lookup Values', 'myevo-weather.png', $m, "{$m}.{$u}.{$a}");
$titleBlock->addCrumb("?m=system", "System Admin");
$titleBlock->show();
?>
<script language="javascript">
<?php
// security improvement:
// some javascript functions may not appear on client side in case of user not having write permissions
// else users would be able to arbitrarily run 'bad' functions
if ($canEdit) {
?>
function delIt(id, name) {
if (confirm('Are you sure you want to delete \'' + name + '\'?')) {
f = document.sysValFrm;
f.del.value = 1;
f.sysval_id.value = id;
f.submit();
}
示例11: urlencode
$start_data_linkable[$i] = urlencode($start_day->getDate());
// $starts[$i] = $start_day->format($df);
$sql = "\n\t\t\tSELECT\n\t\t\t\ttask_log_creator,\n\t\t\t\tsum(task_log_hours) as hours\n\t\t\tFROM\n\t\t\t\ttask_log\n\t\t\tWHERE\n\t\t\t\ttask_log_date >= '" . $start_day->format(FMT_DATETIME_MYSQL) . "' \n\t\t\t\tAND task_log_date <= '" . $end_day->format(FMT_DATETIME_MYSQL) . "'\n\t\t\t\tAND task_log_creator in (" . implode(", ", $ids) . ")\n\t\t\tGROUP BY\n\t\t\t\ttask_log_creator\n\t\t\t";
//print "<pre>$sql</pre>";
$result = db_loadList($sql);
foreach ($result as $row) {
$people[$row['task_log_creator']][$i] = $row['hours'];
}
$date = $start_day->format("%Y-%m-%d") . " 12:00:00";
$start_day->setDate($date, DATE_FORMAT_ISO);
$start_day->addDays(-7);
}
}
$sql = "SELECT company_id, company_name FROM companies WHERE " . getPermsWhereClause("companies", "company_id") . " ORDER BY company_name";
//print "<pre>$sql</pre>";
$companies = arrayMerge(array(0 => $AppUI->_('All Entities')), db_loadHashList($sql));
$next_day = new CDate();
$next_day->copy($start_day);
$next_day->addDays($week_count * 7 * 2);
?>
<form name="frmCompanySelect" action="" method="get">
<input type="hidden" name="m" value="timecard">
<input type="hidden" name="report_type" value="weekly_by_user">
<input type="hidden" name="tab" value="<?php
echo $tab;
?>
">
<table cellspacing="1" cellpadding="2" border="0" width="100%">
<tr>
<td width="95%"><?php
echo arraySelect($companies, 'company_id', 'size="1" class="text" id="medium" onchange="document.frmCompanySelect.submit()"', $company_id);
示例12: getFolderSelectList
function getFolderSelectList()
{
global $AppUI;
$folder = new CFileFolder();
$allowed_folders = array();
$allowed_folders_pre = $folder->getAllowedRecords($AppUI->user_id, 'file_folder_id, file_folder_name' . ', file_folder_parent', 'file_folder_name', 'file_folder_id');
//get array in proper "format" for tree
foreach ($allowed_folders_pre as $results) {
$folder_id = $results['file_folder_id'];
$allowed_folders[$folder_id] = array($results['file_folder_id'], $results['file_folder_name'], $results['file_folder_parent']);
}
$folders = arrayMerge(array(array(0, $AppUI->_('Root'), -1)), $allowed_folders);
return $folders;
}
示例13: arrayMerge
document.AddEdit.submit();
}
</script>
<tr>
<td align="right" nowrap="nowrap"><?php
echo $AppUI->_('Project');
?>
:</td>
<td width="60%">
<?php
// pull the projects list
$q->addTable('projects');
$q->addQuery('project_id, project_name');
$q->addOrder('project_name');
$projects = arrayMerge(array(0 => '(' . $AppUI->_('any', UI_OUTPUT_RAW) . ')'), $q->loadHashList());
echo arraySelect($projects, 'history_project', 'class="text"', $history["history_project"]);
?>
</td>
</tr>
<tr>
<td align="right" nowrap="nowrap"><?php
echo $AppUI->_('Description');
?>
:</td>
<td width="60%">
<textarea name="history_description" class="textarea" cols="60" rows="5" wrap="virtual"><?php
echo $history["history_description"];
?>
</textarea>
示例14: array
global $AppUI, $user_id, $canEdit, $canDelete, $tab;
$perms =& $AppUI->acl();
$module_list = $perms->getModuleList();
//get list of 'real' modules
$pgos = array();
$q = new DBQuery();
$q->addTable('modules', 'm');
$q->addQuery('mod_id, mod_name, permissions_item_table');
$q->addWhere('permissions_item_table is not null');
$q->addWhere("permissions_item_table <> ''");
$module_pgo_list = $q->loadHashList('mod_name');
$q->clear();
//list of additional 'pseudo-modules'
$pseudo_module_pgo_list = array('File Folders' => array('mod_id' => -1, 'mod_name' => 'file_folders', 'permissions_item_table' => 'file_folders'));
//combine modules and 'pseudo-modules'
$pgo_list = arrayMerge($module_pgo_list, $pseudo_module_pgo_list);
// Build an intersection array for the modules and their listing
$modules = array();
$offset = 0;
foreach ($module_list as $module) {
$modules[$module['type'] . "," . $module['id']] = $module['name'];
if ($module['type'] = 'mod' && isset($pgo_list[$module['name']])) {
$pgos[$offset] = $pgo_list[$module['name']]['permissions_item_table'];
}
$offset++;
}
$count = 0;
//Pull User perms
$user_acls = $perms->getUserACLs($user_id);
if (!is_array($user_acls)) {
$user_acls = array();
示例15: dPgetUsers
function dPgetUsers()
{
global $AppUI;
$q = new DBQuery();
$q->addTable('users');
$q->addQuery('user_id, concat_ws(" ", contact_first_name, contact_last_name) as name');
$q->addJoin('contacts', 'con', 'contact_id = user_contact');
$q->addOrder('contact_last_name,contact_first_name');
return arrayMerge(array(0 => $AppUI->_('All Users')), $q->loadHashList());
}