本文整理汇总了PHP中Browse::getAllEntityFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Browse::getAllEntityFields方法的具体用法?PHP Browse::getAllEntityFields怎么用?PHP Browse::getAllEntityFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browse
的用法示例。
在下文中一共展示了Browse::getAllEntityFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
?>
><?php
echo $activeFormats[$entity] . " - " . $record['field_label'];
?>
</option>
<?php
}
?>
</select>
<h2>Dasboard Counts By Micro-thesauri</h2><br/>
<select class="mt_select input-large" name="dashboard_select_counts[]"
multiple="multiple">
<?php
$res = Browse::getAllEntityFields();
$dashboard_select_counts = array();
if ($conf['dashboard_select_counts']) {
$dashboard_select_counts = @json_decode($conf['dashboard_select_counts']);
$dashboard_select_counts = (array) $dashboard_select_counts;
}
foreach ($res as $record) {
$entity = $record['entity'];
if (!$activeFormats[$entity] || !in_array($record['field_type'], array("mt_tree", "mt_select"))) {
continue;
}
$selVal = $entity . "|||" . $record['field_name'];
?>
<option value="<?php
echo $selVal;
?>
示例2: act_dashboard
public function act_dashboard()
{
global $global, $conf;
$activeFormats = getActiveFormats();
$entityFields = Browse::getAllEntityFields();
$response = array();
foreach ($activeFormats as $format => $formatTitle) {
if ($conf['dashboard_format_counts_' . $format] != 'true') {
continue;
}
$count_query = "SELECT COUNT(*) as count FROM {$format} ";
try {
$res_count = $global['db']->Execute($count_query);
foreach ($res_count as $row) {
$response["counts"][$format] = array((int) $row["count"], $formatTitle);
}
} catch (Exception $e) {
}
}
$timelineType = "day";
if ($_REQUEST['timelinetype'] == "month") {
$timelineType = "month";
} elseif ($_REQUEST['timelinetype'] == "year") {
$timelineType = "year";
}
$this->timelineType = $timelineType;
if ($timelineType == "month") {
$dateFormat = '%b %Y';
} elseif ($timelineType == "year") {
$dateFormat = '%Y';
} else {
$dateFormat = '%d %b %Y';
}
$datestart = "";
$dateend = "";
if (isset($_REQUEST['daterange'])) {
$daterange = $_REQUEST['daterange'];
$daterange = explode(",", $daterange);
$datestart2 = trim($daterange[0]);
$dateend2 = trim($daterange[1]);
$date_format = 'Y-m-d';
$timestart = strtotime($datestart2);
$timeend = strtotime($dateend2);
if ($timestart && $timeend) {
$datestart = date($date_format, $timestart);
$dateend = date($date_format, $timeend);
}
}
if ($datestart && $dateend) {
$this->daterange = $datestart . " , " . $dateend;
} else {
$this->daterange = "";
}
/*$sql = "SELECT DATE_FORMAT(m.date_of_entry,'$dateFormat') as val , COUNT(e.event_record_number) AS count
FROM event e join management m on m.entity_id=e.event_record_number and m.entity_type='event' ";
if ($datestart && $dateend) {
$sql .= " where m.date_of_entry BETWEEN '$datestart' AND '$dateend' ";
}
$sql .= "GROUP BY val order by m.date_of_entry ";*/
$dashboard_date_counts = array();
if ($conf['dashboard_date_counts']) {
$dashboard_date_counts = @json_decode($conf['dashboard_date_counts']);
$dashboard_date_counts = (array) $dashboard_date_counts;
}
$response["timeline"] = array();
foreach ($entityFields as $record) {
$entity = $record['entity'];
$field = $record['field_name'];
$selVal = $entity . "|||" . $field;
if (in_array($selVal, $dashboard_date_counts)) {
$primary_key = get_primary_key($entity);
if (in_array($field, array('date_received', 'date_of_entry', 'date_updated'))) {
$sql = "SELECT DATE_FORMAT(m.{$field},'{$dateFormat}') as val , COUNT(e.{$primary_key}) AS count\n FROM {$entity} e join management m on m.entity_id=e.{$primary_key} and m.entity_type='{$entity}' ";
if ($datestart && $dateend) {
$sql .= " where m.{$field} BETWEEN '{$datestart}' AND '{$dateend}' ";
}
$sql .= "GROUP BY val order by m.{$field} ";
} else {
$sql = "SELECT DATE_FORMAT(e.{$field} ,'{$dateFormat}') as val , COUNT(e.{$primary_key}) AS count\n FROM {$entity} e ";
if ($datestart && $dateend) {
$sql .= " where e.{$field} BETWEEN '{$datestart}' AND '{$dateend}' ";
}
$sql .= "GROUP BY val order by e.{$field} ";
}
$response["timeline"][$selVal]['entity'] = $entity;
$response["timeline"][$selVal]['entity_label'] = $activeFormats[$entity];
$response["timeline"][$selVal]['field_name'] = $field;
$response["timeline"][$selVal]['field_label'] = $record['field_label'];
try {
$res_count = $global['db']->Execute($sql);
foreach ($res_count as $row) {
$response["timeline"][$selVal]['data'][0] = array(ucfirst($timelineType), "Count");
if (!$row["val"] && !(int) $row["count"]) {
continue;
}
if (!$row["val"]) {
$row["val"] = "Undefined";
}
$response["timeline"][$selVal]['data'][] = array($row["val"], (int) $row["count"]);
}
//.........这里部分代码省略.........
示例3: getEntityFields
private function getEntityFields()
{
$res = Browse::getAllEntityFields();
$activeFormats = getActiveFormats();
$domain = new Domain();
foreach ($res as $record) {
$entity = $record['entity'];
if (!isset($activeFormats[$entity])) {
continue;
}
if (isset($entity) && !isset($domain->{$entity})) {
$domain->{$entity} = new domain();
$domain->{$entity}->fields = new domain();
// $domain->$entity->fields = array();
}
$fo = new Domain();
$name = $record['field_name'];
$fo->value = $record['field_name'];
$fo->label = $record['field_label'];
$fo->field_type = $record['validation'] == 'number' ? 'number' : $record['field_type'];
$fo->list_code = $record['list_code'];
$fo->select = $record['in_results'];
$domain->{$entity}->fields->{$name} = $fo;
}
//add the entity list
$entities = analysis_get_advance_search_entities();
foreach ($entities as $key => $entity) {
$domain->{$key}->value = $entity['type'];
$domain->{$key}->label = $entity['title'];
$domain->{$key}->desc = $entity['desc'];
$domain->{$key}->ac_type = $entity['ac_type'];
}
return $domain;
}