Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$table_name = w2PgetParam($_GET, 'table_name', 'companies');
$company_id = (int) w2PgetParam($_GET, 'company_id', 0);
$dept_id = (int) w2PgetParam($_GET, 'dept_id', 0);
$select_list = array();
switch ($table_name) {
    case 'companies':
        $id_field = 'company_id';
        $name_field = 'company_name';
        $selection_string = 'Company';
        $dataId = $company_id;
        $company = new CCompany();
        $companyList = $company->getCompanyList();
        foreach ($companyList as $comp) {
            $select_list[$comp['company_id']] = $comp['company_name'];
        }
        break;
    case 'departments':
        $id_field = 'dept_id';
        $name_field = 'dept_name';
        $selection_string = 'Department';
        $dataId = $dept_id;
        $deptList = CDepartment::getDepartmentList(null, $company_id, null);
        foreach ($deptList as $dept) {
            $select_list[$dept['dept_id']] = $dept['dept_name'];
        }
        break;
}
/* $Id: select_contact_company.php 1858 2011-04-30 21:46:55Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/contacts/select_contact_company.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$table_name = w2PgetParam($_GET, 'table_name', 'companies');
$company_id = (int) w2PgetParam($_GET, 'company_id', 0);
$dept_id = (int) w2PgetParam($_GET, 'dept_id', 0);
$select_list = array();
switch ($table_name) {
    case 'companies':
        $id_field = 'company_id';
        $name_field = 'company_name';
        $selection_string = 'Company';
        $dataId = $company_id;
        $company = new CCompany();
        $companyList = $company->getCompanyList($AppUI);
        foreach ($companyList as $comp) {
            $select_list[$comp['company_id']] = $comp['company_name'];
        }
        break;
    case 'departments':
        $id_field = 'dept_id';
        $name_field = 'dept_name';
        $selection_string = 'Department';
        $dataId = $dept_id;
        $deptList = CDepartment::getDepartmentList($AppUI, $company_id, null);
        foreach ($deptList as $dept) {
            $select_list[$dept['dept_id']] = $dept['dept_name'];
        }
        break;
}
Exemplo n.º 4
0
global $search_string;
global $owner_filter_id;
global $currentTabId;
global $currentTabName;
global $tabbed;
global $type_filter;
global $orderby;
global $orderdir;
// load the company types
$types = w2PgetSysVal('CompanyType');
$company_type_filter = $currentTabId;
$company_type_filter = $currentTabName == 'Not Applicable' ? 0 : $company_type_filter;
$company_type_filter = $currentTabName == 'All Companies' ? -1 : $company_type_filter;
$company = new CCompany();
$allowedCompanies = $company->getAllowedRecords($AppUI->user_id, 'company_id, company_name');
$companyList = $company->getCompanyList($AppUI, $company_type_filter, $search_string, $owner_filter_id, $orderby, $orderdir);
?>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
    <tr>
        <?php 
$fieldList = array('company_name', 'countp', 'inactive', 'company_type');
$fieldNames = array('Company Name', 'Active Projects', 'Archived Projects', 'Type');
foreach ($fieldNames as $index => $name) {
    ?>
<th nowrap="nowrap">
                <a href="?m=companies&orderby=<?php 
    echo $fieldList[$index];
    ?>
" class="hdr">
                    <?php 
    echo $AppUI->_($fieldNames[$index]);
Exemplo n.º 5
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $AppUI, $search_string, $owner_filter_id, $tab, $orderby, $orderdir;
$type_filter = $tab - 1;
$company = new CCompany();
$items = $company->getCompanyList(null, $type_filter, $search_string, $owner_filter_id, $orderby, $orderdir);
$module = new w2p_System_Module();
$fields = $module->loadSettings('companies', 'index_list');
if (0 == count($fields)) {
    $fieldList = array('company_name', 'countp', 'inactive', 'company_type');
    $fieldNames = array('Company Name', 'Active Projects', 'Archived Projects', 'Type');
    $module->storeSettings('companies', 'index_list', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$company_types = w2PgetSysVal('CompanyType');
$customLookups = array('company_type' => $company_types);
include $AppUI->getTheme()->resolveTemplate('companies/list');