本文整理汇总了PHP中Contacts::getWorkspaceString方法的典型用法代码示例。如果您正苦于以下问题:PHP Contacts::getWorkspaceString方法的具体用法?PHP Contacts::getWorkspaceString怎么用?PHP Contacts::getWorkspaceString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contacts
的用法示例。
在下文中一共展示了Contacts::getWorkspaceString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDashboardObjectQueries
/**
* Returns array of queries that will return Dashboard Objects
*
* @param string $proj_ids
* @param string $tag
* @param boolean $count if false the query will return objects, if true it will return object count
*/
static function getDashboardObjectQueries($project = null, $tag = null, $count = false, $trashed = false, $linkedObject = null, $order = 'updatedOn', $filterName = '', $archived = false, $filterManager = '')
{
if ($trashed && $trashed !== 'all') {
$order = 'trashedOn';
} else {
if ($archived) {
$order = 'archivedOn';
}
}
switch ($order) {
case 'dateCreated':
$order_crit_companies = '`created_on`';
$order_crit_contacts = '`created_on`';
$order_crit_file_revisions = '`created_on`';
$order_crit_calendar = '`created_on`';
$order_crit_tasks = '`created_on`';
$order_crit_milestones = '`created_on`';
$order_crit_webpages = '`created_on`';
$order_crit_files = '`created_on`';
$order_crit_emails = '`received_date`';
$order_crit_comments = '`created_on`';
$order_crit_messages = '`created_on`';
$order_crit_workspaces = '`created_on`';
break;
case 'trashedOn':
$order_crit_companies = '`trashed_on`';
$order_crit_contacts = '`trashed_on`';
$order_crit_file_revisions = '`trashed_on`';
$order_crit_calendar = '`trashed_on`';
$order_crit_tasks = '`trashed_on`';
$order_crit_milestones = '`trashed_on`';
$order_crit_webpages = '`trashed_on`';
$order_crit_files = '`trashed_on`';
$order_crit_emails = '`trashed_on`';
$order_crit_comments = '`trashed_on`';
$order_crit_messages = '`trashed_on`';
$order_crit_workspaces = '`updated_on`';
break;
case 'archivedOn':
$order_crit_companies = '`archived_on`';
$order_crit_contacts = '`archived_on`';
$order_crit_file_revisions = '`updated_on`';
$order_crit_calendar = '`archived_on`';
$order_crit_tasks = '`archived_on`';
$order_crit_milestones = '`archived_on`';
$order_crit_webpages = '`archived_on`';
$order_crit_files = '`archived_on`';
$order_crit_emails = '`archived_on`';
$order_crit_comments = '`updated_on`';
$order_crit_messages = '`archived_on`';
$order_crit_workspaces = '`completed_on`';
break;
case 'name':
$order_crit_companies = '`name`';
$order_crit_contacts = "TRIM(CONCAT(' ', `lastname`, `firstname`, `middlename`))";
$order_crit_file_revisions = "'zzzzzzzzzzzzzz'";
//Revisar
$order_crit_calendar = '`subject`';
$order_crit_tasks = '`title`';
$order_crit_milestones = '`name`';
$order_crit_webpages = '`title`';
$order_crit_files = '`filename`';
$order_crit_emails = '`subject`';
$order_crit_comments = '`text`';
$order_crit_messages = '`title`';
$order_crit_workspaces = '`name`';
break;
default:
$order_crit_companies = '`updated_on`';
$order_crit_contacts = '`updated_on`';
$order_crit_file_revisions = '`updated_on`';
$order_crit_calendar = '`updated_on`';
$order_crit_tasks = '`updated_on`';
$order_crit_milestones = '`updated_on`';
$order_crit_webpages = '`updated_on`';
$order_crit_files = '`updated_on`';
$order_crit_emails = '`received_date`';
$order_crit_comments = '`updated_on`';
$order_crit_messages = '`updated_on`';
$order_crit_workspaces = '`updated_on`';
break;
}
if ($project instanceof Project) {
$proj_ids = $project->getAllSubWorkspacesQuery(true);
$proj_cond_companies = Companies::getWorkspaceString($proj_ids);
$proj_cond_messages = ProjectMessages::getWorkspaceString($proj_ids);
$proj_cond_documents = ProjectFiles::getWorkspaceString($proj_ids);
$proj_cond_emails = MailContents::getWorkspaceString($proj_ids);
$proj_cond_events = ProjectEvents::getWorkspaceString($proj_ids);
$proj_cond_tasks = ProjectTasks::getWorkspaceString($proj_ids);
$proj_cond_charts = ProjectCharts::getWorkspaceString($proj_ids);
$proj_cond_milestones = ProjectMilestones::getWorkspaceString($proj_ids);
$proj_cond_weblinks = ProjectWebpages::getWorkspaceString($proj_ids);
//.........这里部分代码省略.........
示例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;
}
}