本文整理汇总了PHP中Companies::getCompanyFieldNames方法的典型用法代码示例。如果您正苦于以下问题:PHP Companies::getCompanyFieldNames方法的具体用法?PHP Companies::getCompanyFieldNames怎么用?PHP Companies::getCompanyFieldNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Companies
的用法示例。
在下文中一共展示了Companies::getCompanyFieldNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lang
</div>
</div>
<div class="coInputMainBlock adminMainBlock">
<?php
if (!isset($result_msg)) {
?>
<table style="width:350px;"><tr><th style="text-align:center;" colspan="2"><?php
echo lang('fields to export');
?>
</th></tr>
<?php
if ($import_type == 'contact') {
$contact_fields = Contacts::getContactFieldNames();
} else {
$contact_fields = Companies::getCompanyFieldNames();
}
$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) {
?>
示例2: export_to_csv_file
function export_to_csv_file()
{
$this->setTemplate('csv_export');
$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;
}
if ($type == 'contact') {
$checked_fields = array_var($_POST, 'check_contact');
} else {
$checked_fields = 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 = Companies::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);
$project = active_project();
if ($project instanceof Project) {
$pids = $project->getAllSubWorkspacesQuery(true);
}
$wsConditions = null;
$tag_str = null;
$tag = array_var($_GET, 'active_tag');
if (array_var($_SESSION, 'import_type', 'contact') == 'contact') {
if (isset($pids)) {
$wsConditions = Contacts::getWorkspaceString($pids);
}
if (isset($tag) && $tag && $tag != '') {
$tag_str = " EXISTS (SELECT * FROM `" . TABLE_PREFIX . "tags` `t` WHERE `tag` = " . DB::escape($tag) . " AND `co`.`id` = `t`.`rel_object_id` AND `t`.`rel_object_manager` = 'Contacts') ";
}
$conditions = $wsConditions ? $wsConditions . ($tag_str ? " AND {$tag_str}" : '') : $tag_str;
$conditions .= ($conditions == "" ? "" : " AND ") . "`archived_by_id` = 0" . ($conditions ? " AND {$conditions}" : "");
$contacts = Contacts::instance()->getAllowedContacts($conditions);
foreach ($contacts as $contact) {
fwrite($handle, $this->build_csv_from_contact($contact, $checked_fields) . "\n");
}
} else {
if (isset($pids)) {
$wsConditions = Companies::getWorkspaceString($pids);
}
if (isset($tag) && $tag && $tag != '') {
$tag_str = " EXISTS (SELECT * FROM `" . TABLE_PREFIX . "tags` `t` WHERE `tag` = " . DB::escape($tag) . " AND `" . TABLE_PREFIX . "companies`.`id` = `t`.`rel_object_id` AND `t`.`rel_object_manager` = 'Companies') ";
}
$conditions = $wsConditions ? $wsConditions . ($tag_str ? " AND {$tag_str}" : '') : $tag_str;
$conditions .= ($conditions == "" ? "" : " AND ") . "`archived_by_id` = 0" . ($conditions ? " AND {$conditions}" : "");
$companies = Companies::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;
}
}