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


PHP Contacts::getCompanyFieldNames方法代码示例

本文整理汇总了PHP中Contacts::getCompanyFieldNames方法的典型用法代码示例。如果您正苦于以下问题:PHP Contacts::getCompanyFieldNames方法的具体用法?PHP Contacts::getCompanyFieldNames怎么用?PHP Contacts::getCompanyFieldNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contacts的用法示例。


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

示例1: lang

	
	<div class="coInputMainBlock adminMainBlock">
	
	<table><tr><th></th><th><?php 
    echo $import_type == 'contact' ? lang('contact fields') : lang('company fields');
    ?>
</th><th><?php 
    echo lang('fields from file');
    ?>
</th></tr>
	
	<?php 
    if ($import_type == 'contact') {
        $contact_fields = Contacts::getContactFieldNames();
    } else {
        $contact_fields = Contacts::getCompanyFieldNames();
    }
    $custom_properties = CustomProperties::getAllCustomPropertiesByObjectType(Contacts::instance()->getObjectTypeId());
    +($isAlt = false);
    $i = 0;
    $label_w = $label_h = $label_o = false;
    foreach ($contact_fields as $c_field => $c_label) {
        if (str_starts_with($c_field, 'contact[w') && !$label_w) {
            ?>
<tr><td colspan="3" style="text-align:center;"><b><?php 
            echo lang('work');
            ?>
</b></td></tr> <?php 
            $label_w = true;
        } else {
            if (str_starts_with($c_field, 'contact[h') && !$label_h) {
开发者ID:abhinay100,项目名称:feng_app,代码行数:30,代码来源:csv_import.php

示例2: export_to_csv_file

	function export_to_csv_file() {
		$this->setTemplate('csv_export');
		$ids = array_var($_GET, 'ids');
		$type = array_var($_GET, 'type', array_var($_SESSION, 'import_type', 'contact')); //type of import (contact - company)		
		tpl_assign('import_type', $type);
		if (!isset($_SESSION['import_type']) || ($type != $_SESSION['import_type'] && $type != '')){
			$_SESSION['import_type'] = $type;
		}
                
		$checked_fields = ($type == 'contact') ? array_var($_POST, 'check_contact') : array_var($_POST, 'check_company');
		if (is_array($checked_fields)) {
			$titles = '';
			$imp_type = array_var($_SESSION, 'import_type', 'contact');
			if ($imp_type == 'contact') {
				$field_names = Contacts::getContactFieldNames();
				
				foreach($checked_fields as $k => $v) {
					if (isset($field_names["contact[$k]"]) && $v == 'checked')
						$titles .= $field_names["contact[$k]"] . ',';
				}
				$titles = substr_utf($titles, 0, strlen_utf($titles)-1) . "\n";
			}else{
                                $field_names = Contacts::getCompanyFieldNames();
				
				foreach($checked_fields as $k => $v) {
					if (isset($field_names["company[$k]"]) && $v == 'checked')
						$titles .= $field_names["company[$k]"] . ',';
				}
				$titles = substr_utf($titles, 0, strlen_utf($titles)-1) . "\n";
                        }
				
			$filename = rand().'.tmp';
			$handle = fopen(ROOT.'/tmp/'.$filename, 'wb');
			fwrite($handle, $titles);
			$conditions = '';
			$ids_sql = ($ids)? " AND id IN (".$ids.") " : "";
			if (array_var($_SESSION, 'import_type', 'contact') == 'contact') {
                                $conditions .= ($conditions == "" ? "" : " AND ") . "`archived_by_id` = 0" . ($conditions ? " AND $conditions" : "");
                                $conditions .= $ids_sql;
				$contacts = Contacts::instance()->getAllowedContacts($conditions);
				foreach ($contacts as $contact) {
					fwrite($handle, $this->build_csv_from_contact($contact, $checked_fields) . "\n");
				}
			}else{
                                $conditions .= ($conditions == "" ? "" : " AND ") . "`archived_by_id` = 0" . ($conditions ? " AND $conditions" : "");
                                $conditions .=$ids_sql;
				$companies = Contacts::getVisibleCompanies(logged_user(), $conditions);
				foreach ($companies as $company) {
					fwrite($handle, $this->build_csv_from_company($company, $checked_fields) . "\n");
				}
                        }
			
			fclose($handle);

			$_SESSION['contact_export_filename'] = $filename;
			flash_success(($imp_type == 'contact' ? lang('success export contacts') : lang('success export companies')));
		} else {
			unset($_SESSION['contact_export_filename']);
			return;
		}
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:61,代码来源:ContactController.class.php

示例3: export_to_csv_file

 function export_to_csv_file()
 {
     $ids = array_var($_REQUEST, 'ids');
     $idsall = array_var($_REQUEST, 'allIds');
     $export_all = array_var($_REQUEST, 'export_all');
     $this->setTemplate('csv_export');
     $type = array_var($_REQUEST, 'type', array_var($_SESSION, 'import_type', 'contact'));
     //type of import (contact - company)
     tpl_assign('import_type', $type);
     if (!isset($_SESSION['import_type']) || $type != $_SESSION['import_type'] && $type != '') {
         $_SESSION['import_type'] = $type;
     }
     $delimiter = array_var($_REQUEST, 'delimiter', ',');
     if ($delimiter == '') {
         $delimiter = ',';
     }
     $checked_fields = $type == 'contact' ? array_var($_REQUEST, 'check_contact') : array_var($_REQUEST, 'check_company');
     if (is_array($checked_fields) && ($ids || $idsall || $export_all)) {
         $titles = '';
         $imp_type = array_var($_SESSION, 'import_type', 'contact');
         if ($imp_type == 'contact') {
             $field_names = Contacts::getContactFieldNames();
             foreach ($checked_fields as $k => $v) {
                 if (isset($field_names["contact[{$k}]"]) && $v == 'checked') {
                     $titles .= $field_names["contact[{$k}]"] . $delimiter;
                 }
             }
             $titles = substr_utf($titles, 0, strlen_utf($titles) - 1) . "\n";
         } else {
             $field_names = Contacts::getCompanyFieldNames();
             foreach ($checked_fields as $k => $v) {
                 if (isset($field_names["company[{$k}]"]) && $v == 'checked') {
                     $titles .= $field_names["company[{$k}]"] . $delimiter;
                 }
             }
             $titles = substr_utf($titles, 0, strlen_utf($titles) - 1) . "\n";
         }
         // export the same type of contact objects that are enabled in the contacts tab.
         $extra_conditions = "";
         if (array_var($_SESSION, 'import_type', 'contact') == 'contact') {
             $extra_conditions = '  `is_company` = 0 ';
             if (!user_config_option("viewContactsChecked")) {
                 $extra_conditions .= ' AND  `user_type` != 0 ';
             }
             if (!user_config_option("viewUsersChecked")) {
                 $extra_conditions .= ' AND `user_type` < 1 ';
             }
         }
         // --
         $filename = rand() . '.tmp';
         $handle = fopen(ROOT . '/tmp/' . $filename, 'wb');
         fwrite($handle, $titles);
         $conditions = $extra_conditions;
         $ids_sql = "";
         if (!$export_all) {
             $ids_sql = $ids ? " AND id IN (" . $ids . ") " : "";
         }
         $members = active_context_members(false);
         $context_condition = $this->getActiveContextConditions();
         if (array_var($_SESSION, 'import_type', 'contact') == 'contact') {
             $conditions .= " AND `archived_by_id` = 0 ";
             $conditions .= $ids_sql;
             $conditions .= $context_condition;
             $contacts = Contacts::instance()->getAllowedContacts($conditions);
             foreach ($contacts as $contact) {
                 fwrite($handle, $this->build_csv_from_contact($contact, $checked_fields, $delimiter) . "\n");
             }
         } else {
             $conditions .= ($conditions == "" ? "" : " AND ") . "`archived_by_id` = 0" . ($conditions ? " AND {$conditions}" : "");
             $conditions .= $ids_sql;
             $conditions .= $context_condition;
             $companies = Contacts::getVisibleCompanies(logged_user(), $conditions);
             foreach ($companies as $company) {
                 fwrite($handle, $this->build_csv_from_company($company, $checked_fields, $delimiter) . "\n");
             }
         }
         fclose($handle);
         $_SESSION['contact_export_filename'] = $filename;
         flash_success($imp_type == 'contact' ? lang('success export contacts') : lang('success export companies'));
     }
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:81,代码来源:ContactController.class.php


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