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


PHP TimeExpressionParser::setUnixTimestamps方法代码示例

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


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

示例1: Index

 /**
  * "My Account" screen
  */
 function Index()
 {
     if (!$this->request->isLoggedIn()) {
         return;
     }
     $t_order = new ca_commerce_orders();
     $this->view->setVar('t_order', $t_order);
     # -- open orders
     $va_open_orders = $t_order->getOrders(array('user_id' => $this->request->getUserID(), 'order_status' => array('OPEN', 'SUBMITTED', 'AWAITING_PAYMENT', 'IN_PROCESSING', 'PROCESSED', 'PROCESSED_AWAITING_DIGITIZATION', 'FULFILLED', 'REOPENED')));
     $this->view->setVar('open_order_list', $va_open_orders);
     # --- recent orders
     $this->view->setVar('recent_orders_age_threshold', $vn_recent_orders_age_threshold = (int) $this->opo_client_services_config->get('recent_orders_age_threshold'));
     $vn_c = time() - 60 * 60 * 24 * $vn_recent_orders_age_threshold;
     $o_tep = new TimeExpressionParser();
     $o_tep->setUnixTimestamps($vn_c, time());
     $va_recent_orders = $t_order->getOrders(array('user_id' => $this->request->getUserID(), 'created_on' => $o_tep->getText()));
     $this->view->setVar('recent_order_list', $va_recent_orders);
     # -- all orders
     $va_all_orders = $t_order->getOrders(array('user_id' => $this->request->getUserID()));
     $this->view->setVar('all_order_list', $va_all_orders);
     $va_closed_orders = $t_order->getOrders(array('user_id' => $this->request->getUserID(), 'order_status' => array('COMPLETED')));
     $this->view->setVar('closed_order_list', $va_closed_orders);
     $this->render("Account/my_account_html.php");
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:27,代码来源:AccountController.php

示例2: caGetLocalizedDateRange

/**
 * Returns date range as a localized string for display, subject to the settings in the app/conf/datetime.conf configuration 
 *
 * @param int $pn_start_timestamp Start of date range, as Unix timestamp
 * @param int $pn_end_timestamp End of date range, as Unix timestamp
 * @param array $pa_options All options supported by TimeExpressionParser::getText() are supported
 *
 * @return string Localized date range expression
 */
function caGetLocalizedDateRange($pn_start_timestamp, $pn_end_timestamp, $pa_options = null)
{
    $o_tep = new TimeExpressionParser();
    $o_tep->setUnixTimestamps($pn_start_timestamp, $pn_end_timestamp);
    return $o_tep->getText($pa_options);
}
开发者ID:kai-iak,项目名称:providence,代码行数:15,代码来源:displayHelpers.php

示例3: get

 /**
  * Get a field value of the table row that is represented by this object.
  *
  * @param string $ps_field field name
  * @param array $pa_options options array; can be omitted.
  * It should be an associative array of boolean (except one of the options) flags. In case that some of the options are not set, they are treated as 'false'.
  * Possible options (keys) are:
  * 		BINARY: return field value as is
  * 		FILTER_HTML_SPECIAL_CHARS: convert all applicable chars to their html entities
  * 		DONT_PROCESS_GLOSSARY_TAGS: ?
  * 		CONVERT_HTML_BREAKS: similar to nl2br()
  * 		convertLineBreaks: same as CONVERT_HTML_BREAKS
  * 		getDirectDate: return raw date value from database if $ps_field adresses a date field, otherwise the value will be parsed using the TimeExpressionParser::getText() method
  * 		getDirectTime: return raw time value from database if $ps_field adresses a time field, otherwise the value will be parsed using the TimeExpressionParser::getText() method
  * 		TIMECODE_FORMAT: set return format for fields representing time ranges possible (string) values: COLON_DELIMITED, HOURS_MINUTES_SECONDS, RAW; data will be passed through floatval() by default
  * 		QUOTE: set return value into quotes
  * 		URL_ENCODE: value will be passed through urlencode()
  * 		ESCAPE_FOR_XML: convert <, >, &, ' and " characters for XML use
  * 		DONT_STRIP_SLASHES: if set to true, return value will not be passed through stripslashes()
  * 		template: formatting string to use for returned value; ^<fieldname> placeholder is used to represent field value in template
  * 		returnAsArray: if true, fields that can return multiple values [currently only <table_name>.children.<field>] will return values in an indexed array; default is false
  * 		returnAllLocales:
  * 		delimiter: if set, value is used as delimiter when fields that can return multiple fields are returned as strings; default is a single space
  * 		convertCodesToDisplayText: if set, id values refering to foreign keys are returned as preferred label text in the current locale
  * 		returnURL: if set then url is returned for media, otherwise an HTML tag for display is returned
  * 		dateFormat: format to return created or lastModified dates in. Valid values are iso8601 or text
  *		checkAccess = array of access values to filter results by; if defined only items with the specified access code(s) are returned. Only supported for table that have an "access" field.
  *		sort = optional field to sort returned values on. The field specifiers are fields with or without table name specified.	 
  *		sort_direction = direction to sort results by, either 'asc' for ascending order or 'desc' for descending order; default is 'asc'	 
  */
 public function get($ps_field, $pa_options = null)
 {
     if (!$ps_field) {
         return null;
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     $vb_return_as_array = caGetOption('returnAsArray', $pa_options, false);
     $vb_return_with_structure = caGetOption('returnWithStructure', $pa_options, false);
     $vb_return_all_locales = caGetOption('returnAllLocales', $pa_options, false);
     $vs_delimiter = caGetOption('delimiter', $pa_options, ' ');
     if (($vb_return_with_structure || $vb_return_all_locales) && !$vb_return_as_array) {
         $vb_return_as_array = true;
     }
     $vn_row_id = $this->getPrimaryKey();
     if ($vb_return_as_array && $vb_return_as_array) {
         $vn_locale_id = $this->hasField('locale_id') ? $this->get('locale_id') : null;
     }
     $va_tmp = explode('.', $ps_field);
     if (sizeof($va_tmp) > 1) {
         if ($va_tmp[0] === $this->tableName()) {
             //
             // Return created on or last modified
             //
             if (in_array($va_tmp[1], array('created', 'lastModified'))) {
                 if ($vb_return_as_array) {
                     return $va_tmp[1] == 'lastModified' ? $this->getLastChangeTimestamp() : $this->getCreationTimestamp();
                 } else {
                     $va_data = $va_tmp[1] == 'lastModified' ? $this->getLastChangeTimestamp() : $this->getCreationTimestamp();
                     $vs_subfield = isset($va_tmp[2]) && isset($va_data[$va_tmp[2]]) ? $va_tmp[2] : 'timestamp';
                     $vm_val = $va_data[$vs_subfield];
                     if ($vs_subfield == 'timestamp') {
                         $o_tep = new TimeExpressionParser();
                         $o_tep->setUnixTimestamps($vm_val, $vm_val);
                         $vm_val = $o_tep->getText($pa_options);
                     }
                     return $vm_val;
                 }
             }
             //
             // Generalized get
             //
             $va_field_info = $this->getFieldInfo($va_tmp[1]);
             switch (sizeof($va_tmp)) {
                 case 2:
                     // support <table_name>.<field_name> syntax
                     $ps_field = $va_tmp[1];
                     break;
                 default:
                     // > 2 elements
                     // media field?
                     if ($va_field_info['FIELD_TYPE'] === FT_MEDIA && !isset($pa_options['returnAsArray']) && !$pa_options['returnAsArray']) {
                         $o_media_settings = new MediaProcessingSettings($va_tmp[0], $va_tmp[1]);
                         $va_versions = $o_media_settings->getMediaTypeVersions('*');
                         $vs_version = $va_tmp[2];
                         if (!isset($va_versions[$vs_version])) {
                             $va_available_versions = array_keys($va_versions);
                             $vs_version = $va_tmp[2] = array_shift($va_available_versions);
                         }
                         if (isset($va_tmp[3])) {
                             return $this->getMediaInfo($va_tmp[1], $vs_version, 'width');
                         } else {
                             if (isset($pa_options['returnURL']) && $pa_options['returnURL']) {
                                 return $this->getMediaUrl($va_tmp[1], $vs_version, $pa_options);
                             } else {
                                 return $this->getMediaTag($va_tmp[1], $vs_version, $pa_options);
                             }
                         }
                     }
//.........这里部分代码省略.........
开发者ID:samrahman,项目名称:providence,代码行数:101,代码来源:BaseModel.php

示例4: getUsers

 /**
  * Returns array of users associated with the currently loaded row. The array
  * is key'ed on user user user_id; each value is an  array containing information about the user. Array keys are:
  *			user_id			[user_id for user]
  *			user_name	[name of user]
  *			code				[short alphanumeric code identifying the group]
  *			description	[text description of group]
  *
  * @return array List of groups associated with the currently loaded row
  */
 public function getUsers($pa_options = null)
 {
     if (!($vn_id = (int) $this->getPrimaryKey())) {
         return null;
     }
     if (!($vs_user_rel_table = $this->getProperty('USERS_RELATIONSHIP_TABLE'))) {
         return null;
     }
     $vs_pk = $this->primaryKey();
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     $vb_return_for_bundle = isset($pa_options['returnAsInitialValuesForBundle']) && $pa_options['returnAsInitialValuesForBundle'] ? true : false;
     $o_dm = Datamodel::load();
     $t_rel = $o_dm->getInstanceByTableName($vs_user_rel_table);
     $vb_supports_date_restrictions = (bool) $t_rel->hasField('effective_date');
     $o_tep = new TimeExpressionParser();
     $o_db = $this->getDb();
     $qr_res = $o_db->query("\n\t\t\t\tSELECT u.*, r.*\n\t\t\t\tFROM {$vs_user_rel_table} r\n\t\t\t\tINNER JOIN ca_users AS u ON u.user_id = r.user_id\n\t\t\t\tWHERE\n\t\t\t\t\tr.{$vs_pk} = ?\n\t\t\t", $vn_id);
     $va_users = array();
     $va_user_ids = $qr_res->getAllFieldValues("user_id");
     if ($qr_users = $this->makeSearchResult('ca_users', $va_user_ids)) {
         $va_initial_values = caProcessRelationshipLookupLabel($qr_users, new ca_users(), array('stripTags' => true));
     } else {
         $va_initial_values = array();
     }
     $qr_res->seek(0);
     while ($qr_res->nextRow()) {
         $va_row = array();
         foreach (array('user_id', 'user_name', 'fname', 'lname', 'email', 'sdatetime', 'edatetime', 'access') as $vs_f) {
             $va_row[$vs_f] = $qr_res->get($vs_f);
         }
         if ($vb_supports_date_restrictions) {
             $o_tep->init();
             $o_tep->setUnixTimestamps($qr_res->get('sdatetime'), $qr_res->get('edatetime'));
             $va_row['effective_date'] = $o_tep->getText();
         }
         if ($vb_return_for_bundle) {
             $va_row['label'] = $va_initial_values[$va_row['user_id']]['label'];
             $va_row['id'] = $va_row['user_id'];
             $va_users[(int) $qr_res->get('relation_id')] = $va_row;
         } else {
             $va_users[(int) $qr_res->get('user_id')] = $va_row;
         }
     }
     return $va_users;
 }
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:57,代码来源:LabelableBaseModelWithAttributes.php

示例5: DownloadUserReport

 public function DownloadUserReport()
 {
     $vs_download_format = $this->request->getParameter("download_format", pString);
     if (!$vs_download_format) {
         $vs_download_format = "tab";
     }
     $this->view->setVar("download_format", $vs_download_format);
     switch ($vs_download_format) {
         default:
         case "tab":
             $this->view->setVar("file_extension", "txt");
             $this->view->setVar("mimetype", "text/plain");
             $vs_delimiter_col = "\t";
             $vs_delimiter_row = "\n";
             break;
             # -----------------------------------
         # -----------------------------------
         case "csv":
             $this->view->setVar("file_extension", "txt");
             $this->view->setVar("mimetype", "text/plain");
             $vs_delimiter_col = ",";
             $vs_delimiter_row = "\n";
             break;
             # -----------------------------------
     }
     $o_db = new Db();
     $t_user = new ca_users();
     $va_fields = array("lname", "fname", "email", "user_name", "userclass", "active", "last_login");
     $va_profile_prefs = $t_user->getValidPreferences('profile');
     $va_profile_prefs_labels = array();
     foreach ($va_profile_prefs as $vs_pref) {
         $va_pref_info = $t_user->getPreferenceInfo($vs_pref);
         $va_profile_prefs_labels[$vs_pref] = $va_pref_info["label"];
     }
     $qr_users = $o_db->query("SELECT * FROM ca_users ORDER BY user_id DESC");
     if ($qr_users->numRows()) {
         $va_rows = array();
         # --- headings
         $va_row = array();
         # --- headings for field values
         foreach ($va_fields as $vs_field) {
             switch ($vs_field) {
                 case "last_login":
                     $va_row[] = _t("Last login");
                     break;
                     # --------------------
                 # --------------------
                 default:
                     $va_row[] = $t_user->getDisplayLabel("ca_users." . $vs_field);
                     break;
                     # --------------------
             }
         }
         # --- headings for profile prefs
         foreach ($va_profile_prefs_labels as $vs_pref => $vs_pref_label) {
             $va_row[] = $vs_pref_label;
         }
         $va_rows[] = join($vs_delimiter_col, $va_row);
         reset($va_fields);
         reset($va_profile_prefs_labels);
         $o_tep = new TimeExpressionParser();
         while ($qr_users->nextRow()) {
             $va_row = array();
             # --- fields
             foreach ($va_fields as $vs_field) {
                 switch ($vs_field) {
                     case "userclass":
                         $va_row[] = $t_user->getChoiceListValue($vs_field, $qr_users->get("ca_users." . $vs_field));
                         break;
                         # -----------------------
                     # -----------------------
                     case "active":
                         $va_row[] = $qr_users->get("ca_users." . $vs_field) == 1 ? _t("active") : _t("not active");
                         break;
                         # -----------------------
                     # -----------------------
                     case "last_login":
                         //if (!is_array($va_vars = $qr_users->getVars('vars'))) { $va_vars = array(); }
                         if (!is_array($va_vars = $qr_users->getVars('volatile_vars'))) {
                             $va_vars = array();
                         }
                         if ($va_vars['last_login'] > 0) {
                             $o_tep->setUnixTimestamps($va_vars['last_login'], $va_vars['last_login']);
                             $va_row[] = $o_tep->getText();
                         } else {
                             $va_row[] = "-";
                         }
                         break;
                         # -----------------------
                     # -----------------------
                     default:
                         if ($vs_download_format == "csv") {
                             $va_row[] = str_replace(",", "-", $qr_users->get("ca_users." . $vs_field));
                         } else {
                             $va_row[] = $qr_users->get("ca_users." . $vs_field);
                         }
                         break;
                         # -----------------------
                 }
             }
//.........这里部分代码省略.........
开发者ID:samrahman,项目名称:providence,代码行数:101,代码来源:UsersController.php

示例6: _t

?>
					</th>
					<th class="list-header-unsorted">
						<?php 
print _t('Last login');
?>
					</th>
					<th class="{sorter: false} list-header-nosort">&nbsp;</th>
				</tr>
			</thead>
			<tbody>
<?php 
$o_tep = new TimeExpressionParser();
foreach ($va_user_list as $va_user) {
    if ($va_user['last_login'] > 0) {
        $o_tep->setUnixTimestamps($va_user['last_login'], $va_user['last_login']);
    }
    ?>
			<tr>
				<td>
					<?php 
    print $va_user['user_name'];
    ?>
				</td>
				<td>
					<?php 
    print $va_user['lname'] . ', ' . $va_user['fname'];
    ?>
				</td>
				<td>
					<?php 
开发者ID:guaykuru,项目名称:pawtucket,代码行数:31,代码来源:user_list_html.php

示例7: renderWidget

 public function renderWidget($ps_widget_id, &$pa_settings)
 {
     parent::renderWidget($ps_widget_id, $pa_settings);
     global $g_ui_locale_id;
     if (!in_array($pa_settings['display_type'], BaseWidget::$s_widget_settings['recentlyCreatedWidget']["display_type"]["options"])) {
         return "";
     }
     if ($t_table = $this->opo_datamodel->getInstanceByTableName($pa_settings['display_type'], true)) {
         $vo_db = new Db();
         $o_tep = new TimeExpressionParser();
         if ($pa_settings["display_limit"] && intval($pa_settings["display_limit"]) > 0 && intval($pa_settings["display_limit"]) < 1000) {
             $vn_limit = intval($pa_settings["display_limit"]);
         } else {
             $vn_limit = 11;
         }
         $vs_deleted_sql = '';
         if ($t_table->hasField('deleted')) {
             $vs_deleted_sql = " AND (t.deleted = 0) ";
         }
         $vs_idno_sql = '';
         if ($t_table->hasField('idno')) {
             $vs_idno_sql = "t.idno,";
         } elseif ($t_table->hasField('idno_stub')) {
             $vs_idno_sql = "t.idno_stub,";
         }
         $vs_sql = "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tt.{$t_table->primaryKey()},\n\t\t\t\t\t\tlt.{$t_table->getLabelDisplayField()},\n\t\t\t\t\t\t{$vs_idno_sql}\n\t\t\t\t\t\tlt.locale_id\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{$t_table->tableName()} t\n\t\t\t\t\tINNER JOIN\n\t\t\t\t\t\t{$t_table->getLabelTableName()} AS lt ON t.{$t_table->primaryKey()} = lt.{$t_table->primaryKey()}\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t(lt.is_preferred = 1) \n\t\t\t\t\t\t{$vs_deleted_sql}\n\t\t\t\t\tORDER BY\n\t\t\t\t\t\tt.{$t_table->primaryKey()} DESC\n\t\t\t\t\tLIMIT\n\t\t\t\t\t\t{$vn_limit}\n\t\t\t\t";
         $qr_records = $vo_db->query($vs_sql);
         $va_item_list = array();
         while ($qr_records->nextRow() && sizeof($va_item_list) < intval($pa_settings["display_limit"])) {
             if (isset($va_item_list[$qr_records->get($t_table->primaryKey())])) {
                 // we only overwrite if we hit one with UI locale (i.e. the first hit wins if there is no label in UI locale)
                 if (!(intval($qr_records->get($t_table->getLabelTableName() . ".locale_id")) == intval($g_ui_locale_id))) {
                     continue;
                 }
             }
             $vs_sql = "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tlog_datetime\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tca_change_log\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tlogged_table_num = " . (int) $t_table->tableNum() . "\n\t\t\t\t\t\tAND\n\t\t\t\t\t\t\tchangetype = 'I'\n\t\t\t\t\t\tAND\n\t\t\t\t\t\t\tlogged_row_id = " . (int) $qr_records->get($t_table->primaryKey()) . "\n\t\t\t\t\t";
             $qr_create_date = $vo_db->query($vs_sql);
             if ($qr_create_date->nextRow()) {
                 $vn_time_created = intval($qr_create_date->get("log_datetime"));
                 $o_tep->setUnixTimestamps($vn_time_created, $vn_time_created);
                 $va_options = $this->opb_dont_show_timestamp ? array('timeOmit' => true) : null;
                 $vs_datetime_text = $o_tep->getText($va_options);
             } else {
                 $vs_datetime_text = '';
             }
             $va_item_list[$qr_records->get($t_table->primaryKey())] = array("display" => $qr_records->get($t_table->getLabelTableName() . "." . $t_table->getLabelDisplayField()), "idno" => $qr_records->get("idno"), "idno_stub" => $qr_records->get("idno_stub"), "locale_id" => $qr_records->get($t_table->getLabelTableName() . ".locale_id"), "datetime" => $vs_datetime_text);
         }
         if (!(intval($pa_settings["height_px"]) > 30 && intval($pa_settings["height_px"]) < 1000)) {
             // if value is not within reasonable boundaries, set it to default
             $this->opo_view->setVar("height_px", 270);
         } else {
             $this->opo_view->setVar("height_px", intval($pa_settings["height_px"]));
         }
         $this->opo_view->setVar('item_list', $va_item_list);
         $this->opo_view->setVar('table_num', $this->opo_datamodel->getTableNum($t_table->tableName()));
         $this->opo_view->setVar('request', $this->getRequest());
         $this->opo_view->setVar('table_display', $this->opa_table_display_names[$t_table->tableName()]);
         $this->opo_view->setVar('idno_display', isset($pa_settings["display_idno"]) ? $pa_settings["display_idno"] : FALSE);
         return $this->opo_view->render('main_html.php');
     }
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:61,代码来源:recentlyCreatedWidget.php

示例8: getAccessExpirationDates

 /**
  * 
  *
  * @param int $pn_user_id user_id of user to check set access for
  * @param int $pn_access type of access required. Use __CA_SET_READ_ACCESS__ for read-only access or __CA_SET_EDIT_ACCESS__ for editing (full) access
  * @param int $pa_set_ids The ids of the sets to check. If omitted then currently loaded set will be checked. Can also be set to a single integer.
  * @return int
  */
 public function getAccessExpirationDates($pn_user_id, $pn_access, $pa_set_ids = null, $pa_options = null)
 {
     if (!is_array($pa_set_ids)) {
         if (!$pa_set_ids) {
             $pa_set_ids = $this->get('set_id');
         }
         if (!$pa_set_ids) {
             return null;
         }
         $pa_set_ids = array($pa_set_ids);
     }
     foreach ($pa_set_ids as $vn_i => $vn_set_id) {
         $pa_set_ids[$vn_i] = (int) $vn_set_id;
     }
     $o_db = $this->getDb();
     $qr_res = $o_db->query("\n\t\t\tSELECT sxg.set_id, sxg.sdatetime, sxg.edatetime, s.user_id\n\t\t\tFROM ca_sets_x_user_groups sxg\n\t\t\tINNER JOIN ca_user_groups AS ug ON sxg.group_id = ug.group_id\n\t\t\tINNER JOIN ca_users_x_groups AS uxg ON uxg.group_id = ug.group_id\n\t\t\tINNER JOIN ca_sets AS s ON s.set_id = sxg.set_id\n\t\t\tWHERE \n\t\t\t\t(sxg.access >= ?) AND (uxg.user_id = ?) AND (sxg.set_id IN (?)) AND (s.deleted = 0)\n\t\t\t\tAND\n\t\t\t\t(\n\t\t\t\t\tsxg.sdatetime <= " . time() . " AND sxg.edatetime >= " . time() . "\n\t\t\t\t)\n\t\t", (int) $pn_access, (int) $pn_user_id, $pa_set_ids);
     $o_tep = new TimeExpressionParser();
     $va_expiration_times = array();
     while ($qr_res->nextRow()) {
         if ($qr_res->get('user_id') == $pn_user_id) {
             $va_expiration_times[$vn_set_id] = -1;
             continue;
         }
         $vn_set_id = $qr_res->get('set_id');
         $vn_exp = $qr_res->get('edatetime');
         if (!isset($va_expiration_times[$vn_set_id]) || $va_expiration_times[$vn_set_id] < $vn_exp) {
             $o_tep->setUnixTimestamps($vn_exp, $vn_exp);
             $vs_text = $o_tep->getText();
             $va_expiration_times[$vn_set_id] = $vs_text;
         }
     }
     $qr_res = $o_db->query("\n\t\t\tSELECT sxu.set_id, sxu.sdatetime, sxu.edatetime, s.user_id\n\t\t\tFROM ca_sets_x_users sxu\n\t\t\tINNER JOIN ca_users AS u ON sxu.user_id = u.user_id\n\t\t\tINNER JOIN ca_sets AS s ON s.set_id = sxu.set_id\n\t\t\tWHERE \n\t\t\t\t(sxu.access >= ?) AND (u.user_id = ?) AND (sxu.set_id IN (?)) AND (s.deleted = 0)\n\t\t\t\tAND\n\t\t\t\t(\n\t\t\t\t\tsxu.sdatetime <= " . time() . " AND sxu.edatetime >= " . time() . "\n\t\t\t\t)\n\t\t", (int) $pn_access, (int) $pn_user_id, $pa_set_ids);
     while ($qr_res->nextRow()) {
         if ($qr_res->get('user_id') == $pn_user_id) {
             $va_expiration_times[$vn_set_id] = -1;
             continue;
         }
         $vn_set_id = $qr_res->get('set_id');
         $vn_exp = $qr_res->get('edatetime');
         if (!isset($va_expiration_times[$vn_set_id]) || $va_expiration_times[$vn_set_id] < $vn_exp) {
             $o_tep->setUnixTimestamps($vn_exp, $vn_exp);
             $vs_text = $o_tep->getText();
             $va_expiration_times[$vn_set_id] = $vs_text;
         }
     }
     return $va_expiration_times;
 }
开发者ID:kai-iak,项目名称:providence,代码行数:55,代码来源:ca_sets.php

示例9: getComments

 /**
  *
  */
 public function getComments($ps_mode = null, $pn_limit = null, $pa_options = null)
 {
     $o_db = $this->getDb();
     $vs_where = '';
     switch ($ps_mode) {
         case 'moderated':
             $vs_where = "WHERE cic.moderated_on IS NOT NULL";
             break;
         case 'unmoderated':
             $vs_where = "WHERE cic.moderated_on IS NULL";
             break;
     }
     if (intval($pn_limit) > 0) {
         $vs_limit = " LIMIT " . intval($pn_limit);
     }
     $o_tep = new TimeExpressionParser();
     $qr_res = $o_db->query("\n\t\t\tSELECT cic.*, u.user_id, u.fname, u.lname, u.email user_email\n\t\t\tFROM ca_item_comments cic\n\t\t\tLEFT JOIN ca_users AS u ON u.user_id = cic.user_id\n\t\t\t{$vs_where} ORDER BY cic.created_on DESC {$vs_limit}\n\t\t");
     $o_datamodel = $this->getAppDatamodel();
     $va_comments = array();
     while ($qr_res->nextRow()) {
         $vn_datetime = $qr_res->get('created_on');
         $o_tep->setUnixTimestamps($vn_datetime, $vn_datetime);
         $va_row = $qr_res->getRow();
         $va_row['created_on'] = $o_tep->getText();
         $t_table = $o_datamodel->getInstanceByTableNum($qr_res->get('table_num'), true);
         if ($t_table->load($qr_res->get('row_id'))) {
             $va_row['commented_on'] = $t_table->getLabelForDisplay(false);
             if ($vs_idno = $t_table->get('idno')) {
                 $va_row['commented_on'] .= ' [' . $vs_idno . ']';
             }
         }
         foreach (array("media1", "media2", "media3", "media4") as $vs_media_field) {
             $va_media_versions = array();
             $va_media_versions = $qr_res->getMediaVersions($vs_media_field);
             $va_media = array();
             if (is_array($va_media_versions) && sizeof($va_media_versions) > 0) {
                 foreach ($va_media_versions as $vs_version) {
                     $va_image_info = array();
                     $va_image_info = $qr_res->getMediaInfo($vs_media_field, $vs_version);
                     $va_image_info["TAG"] = $qr_res->getMediaTag($vs_media_field, $vs_version);
                     $va_image_info["URL"] = $qr_res->getMediaUrl($vs_media_field, $vs_version);
                     $va_media[$vs_version] = $va_image_info;
                 }
                 $va_row[$vs_media_field] = $va_media;
             }
         }
         $va_comments[] = $va_row;
     }
     return $va_comments;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:53,代码来源:ca_item_comments.php

示例10: getAllTags

 /**
  * Returns all tags attached to any kind of row.
  * If the optional $pb_moderation_status parameter is passed then only tags matching the criteria will be returned:
  *		Passing $pb_moderation_status = TRUE will cause only moderated tags to be returned
  *		Passing $pb_moderation_status = FALSE will cause only unmoderated tags to be returned
  *		If you want both moderated and unmoderated tags to be returned then omit the parameter or pass a null value
  *
  * @param bool $pb_moderation_status To return only unmoderated tags set to FALSE; to return only moderated tags set to TRUE; to return all tags set to null or omit
  * @param int $pn_limit Maximum number of tags to return. Default is 0 - no limit.
  * 
  * @return array
  */
 public function getAllTags($pb_moderation_status = null, $pn_limit = 0)
 {
     $o_db = $this->getDb();
     $vs_where = '';
     if ($pb_moderation_status === true) {
         $vs_where = ' WHERE cixt.moderated_on IS NULL';
     } elseif ($pb_moderation_status === false) {
         $vs_where = ' WHERE cixt.moderated_on IS NOT NULL';
     } else {
         $vs_where = '';
     }
     $vs_limit = "";
     if (intval($pn_limit) > 0) {
         $vs_limit = " LIMIT " . intval($pn_limit);
     }
     $o_tep = new TimeExpressionParser();
     $qr_res = $o_db->query("\n\t\t\tSELECT cit.*, cixt.*, u.user_id, u.fname, u.lname, u.email user_email\n\t\t\tFROM ca_items_x_tags cixt\n\t\t\tLEFT JOIN ca_users AS u ON u.user_id = cixt.user_id\n\t\t\tINNER JOIN ca_item_tags AS cit ON cit.tag_id = cixt.tag_id\n\t\t\t{$vs_where} ORDER BY cixt.created_on DESC {$vs_limit}\n\t\t");
     $o_datamodel = $this->getAppDatamodel();
     $va_tags = array();
     while ($qr_res->nextRow()) {
         $vn_datetime = $qr_res->get('created_on');
         $o_tep->setUnixTimestamps($vn_datetime, $vn_datetime);
         $va_row = $qr_res->getRow();
         $va_row['created_on'] = $o_tep->getText();
         $t_table = $o_datamodel->getInstanceByTableNum($qr_res->get('table_num'), true);
         if ($t_table->load($qr_res->get('row_id'))) {
             $va_row['item_tagged'] = $t_table->getLabelForDisplay(false);
             if ($vs_idno = $t_table->get('idno')) {
                 $va_row['item_tagged'] .= ' [' . $vs_idno . ']';
             }
         }
         $va_tags[] = $va_row;
     }
     return $va_tags;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:47,代码来源:ca_item_tags.php

示例11: _get

 /**
  * Implementation of primary get() functionality
  */
 private function _get($ps_field, $pa_options = null)
 {
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (isset($pa_options['restrictToType']) && (!isset($pa_options['restrict_to_type']) || !$pa_options['restrict_to_type'])) {
         $pa_options['restrict_to_type'] = $pa_options['restrictToType'];
     }
     if (isset($pa_options['restrictToTypes']) && (!isset($pa_options['restrict_to_types']) || !$pa_options['restrict_to_types'])) {
         $pa_options['restrict_to_types'] = $pa_options['restrictToTypes'];
     }
     if (isset($pa_options['restrictToRelationshipTypes']) && (!isset($pa_options['restrict_to_relationship_types']) || !$pa_options['restrict_to_relationship_types'])) {
         $pa_options['restrict_to_relationship_types'] = $pa_options['restrictToRelationshipTypes'];
     }
     if (isset($pa_options['excludeType']) && (!isset($pa_options['exclude_type']) || !$pa_options['exclude_type'])) {
         $pa_options['exclude_type'] = $pa_options['excludeType'];
     }
     if (isset($pa_options['excludeTypes']) && (!isset($pa_options['exclude_types']) || !$pa_options['exclude_types'])) {
         $pa_options['exclude_types'] = $pa_options['excludeTypes'];
     }
     if (isset($pa_options['excludeRelationshipTypes']) && (!isset($pa_options['exclude_relationship_types']) || !$pa_options['exclude_relationship_types'])) {
         $pa_options['exclude_relationship_types'] = $pa_options['excludeRelationshipTypes'];
     }
     $vb_return_as_array = caGetOption('returnAsArray', $pa_options, false, array('castTo' => 'bool'));
     $vb_return_all_locales = caGetOption('returnAllLocales', $pa_options, false, array('castTo' => 'bool'));
     $vb_return_as_link = caGetOption('returnAsLink', $pa_options, false, array('castTo' => 'bool'));
     $vs_return_as_link_text = caGetOption('returnAsLinkText', $pa_options, '');
     $vs_return_as_link_target = caGetOption('returnAsLinkTarget', $pa_options, '');
     $vs_return_as_link_attributes = caGetOption('returnAsLinkAttributes', $pa_options, array(), array('castTo' => 'array'));
     $va_original_path_components = $va_path_components = $this->getFieldPathComponents($ps_field);
     if ($va_path_components['table_name'] != $this->ops_table_name) {
         $vs_access_chk_key = $va_path_components['table_name'] . ($va_path_components['field_name'] ? '.' . $va_path_components['field_name'] : '');
     } else {
         $vs_access_chk_key = $va_path_components['field_name'];
     }
     if (caGetBundleAccessLevel($this->ops_table_name, $vs_access_chk_key) == __CA_BUNDLE_ACCESS_NONE__) {
         return null;
     }
     $vo_request = caGetOption('request', $pa_options, null);
     unset($pa_options['request']);
     // first see if the search engine can provide the field value directly (fastest)
     if (!(($vs_value = $this->opo_engine_result->get($ps_field, $pa_options)) === false)) {
         if ($vb_return_as_array) {
             if ($vb_return_all_locales) {
                 return array(1 => $vs_value);
             } else {
                 return array($vs_value);
             }
         } else {
             return $vs_value;
         }
     }
     $vs_template = caGetOption('template', $pa_options, null);
     $vs_delimiter = caGetOption('delimiter', $pa_options, ' ');
     $vs_hierarchical_delimiter = caGetOption('hierarchicalDelimiter', $pa_options, ' ');
     if ($vb_return_all_locales && !$vb_return_as_array) {
         $vb_return_as_array = true;
     }
     if (isset($pa_options['sort']) && !is_array($pa_options['sort'])) {
         $pa_options['sort'] = array($pa_options['sort']);
     }
     if (is_array($va_sort_fields = isset($pa_options['sort']) && is_array($pa_options['sort']) ? $pa_options['sort'] : null)) {
         foreach ($va_sort_fields as $vn_i => $vs_sort_fld) {
             if (!trim($vs_sort_fld)) {
                 unset($va_sort_fields[$vn_i]);
             }
         }
     }
     $vn_row_id = $this->opo_engine_result->get($this->ops_table_pk);
     // try to lazy load (slower)...
     //
     // Are we getting timestamp (created on or last modified) info?
     //
     if ($va_path_components['table_name'] == $this->ops_table_name && $va_path_components['field_name'] == 'created') {
         if (!isset($this->opa_timestamp_cache['created_on'][$this->ops_table_name][$vn_row_id])) {
             $this->prefetchChangeLogData($this->ops_table_name, $this->opo_engine_result->currentRow(), $this->getOption('prefetch'));
         }
         if ($vb_return_as_array) {
             return $this->opa_timestamp_cache['created_on'][$this->ops_table_name][$vn_row_id];
         } else {
             $vs_subfield = $va_path_components['subfield_name'] ? $va_path_components['subfield_name'] : 'timestamp';
             $vm_val = $this->opa_timestamp_cache['created_on'][$this->ops_table_name][$vn_row_id][$vs_subfield];
             if ($vs_subfield == 'timestamp') {
                 $o_tep = new TimeExpressionParser();
                 $o_tep->setUnixTimestamps($vm_val, $vm_val);
                 $vm_val = $o_tep->getText($pa_options);
             }
             return $vm_val;
         }
     }
     if ($va_path_components['table_name'] == $this->ops_table_name && $va_path_components['field_name'] == 'lastModified') {
         if (!isset($this->opa_timestamp_cache['last_changed'][$this->ops_table_name][$vn_row_id])) {
             $this->prefetchChangeLogData($this->ops_table_name, $this->opo_engine_result->currentRow(), $this->getOption('prefetch'));
         }
         if ($vb_return_as_array) {
             return $this->opa_timestamp_cache['last_changed'][$this->ops_table_name][$vn_row_id];
         } else {
//.........这里部分代码省略.........
开发者ID:ffarago,项目名称:pawtucket2,代码行数:101,代码来源:SearchResult.php

示例12: caNavButton

<?php 
    if ($vo_result->getMediaTag('ca_item_comments.media1', "thumbnail")) {
        print "<span style='white-space: nowrap;'>" . $vo_result->getMediaTag("ca_item_comments.media1", "thumbnail");
        print caNavButton($this->request, __CA_NAV_BUTTON_DOWNLOAD__, _t('Download'), '', 'manage', 'Comments', 'DownloadMedia', array('version' => 'original', 'comment_id' => $vo_result->get('ca_item_comments.comment_id'), 'mode' => 'search', 'download' => 1), array(), array('no_background' => true, 'dont_show_content' => true));
        print "</span>";
    }
    ?>
					</td>
					<td>
						<?php 
    print ($vn_tmp = $vo_result->get('ca_item_comments.rating')) ? $vn_tmp : "-";
    ?>
					</td>
					<td>
<?php 
    $o_tep->setUnixTimestamps($vn_tmp = $vo_result->get('ca_item_comments.created_on'), $vn_tmp);
    print $o_tep->getText();
    ?>
					</td>
					<td>
<?php 
    $vs_commented_on = "";
    if ($t_table->load($vo_result->get('ca_item_comments.row_id'))) {
        $vs_commented_on = $t_table->getLabelForDisplay(false);
        if ($vs_idno = $t_table->get('idno')) {
            $vs_commented_on .= ' [' . $vs_idno . ']';
        }
    }
    print $vs_commented_on;
    ?>
					</td>
开发者ID:idiscussforum,项目名称:providence,代码行数:31,代码来源:ca_item_comments_list_html.php

示例13: time

 * This source code is free and modifiable under the terms of 
 * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
 * the "license.txt" file for details, or visit the CollectiveAccess web site at
 * http://www.CollectiveAccess.org
 *
 * ----------------------------------------------------------------------
 */
$po_request = $this->getVar('request');
$vs_widget_id = $this->getVar('widget_id');
$vn_table_num = $this->getVar('table_num');
$t_log = $this->getVar('change_log');
$vn_threshold_in_seconds = $this->getVar('threshold_in_hours') * 3600;
$vn_end_date_for_display = time();
$vn_start_date_for_display = $vn_end_date_for_display - $vn_threshold_in_seconds;
$o_tep = new TimeExpressionParser();
$o_tep->setUnixTimestamps($vn_start_date_for_display, $vn_end_date_for_display);
$vn_displayed_date_range = $o_tep->getText(array('timeOmit' => true));
$va_log_entries = array_reverse($t_log->getRecentChanges($vn_table_num, $vn_threshold_in_seconds, 1000));
// reverse to put most recent up top
?>
<div class="dashboardWidgetContentContainer">
<?php 
if (sizeof($va_log_entries) > 0) {
    ?>
			<div class="dashboardWidgetHeading"><?php 
    print _t("Changes to <strong>%1</strong> from %2", $this->getVar('table_name_plural'), $vn_displayed_date_range);
    ?>
</div>
			<div class="dashboardWidgetScrollMedium" style="padding-left:10px;"><ul>
<?php 
    foreach ($va_log_entries as $vs_log_key => $va_log_entry) {
开发者ID:idiscussforum,项目名称:providence,代码行数:31,代码来源:main_html.php

示例14: _getChangeLogFromRawData

 /**
  *
  */
 private function _getChangeLogFromRawData($pa_data, $pn_table_num, $pa_options = null)
 {
     //print "<pre>".print_r($pa_data, true)."</pre>\n";
     $va_log_output = array();
     $vs_blank_placeholder = '&lt;' . _t('BLANK') . '&gt;';
     $o_tep = new TimeExpressionParser();
     if (!$pa_options) {
         $pa_options = array();
     }
     if (sizeof($pa_data)) {
         //
         // Init
         //
         $o_datamodel = Datamodel::load();
         $va_change_types = array('I' => _t('Added'), 'U' => _t('Edited'), 'D' => _t('Deleted'));
         $vs_label_table_name = $vs_label_display_name = '';
         $t_item = $o_datamodel->getInstanceByTableNum($pn_table_num, true);
         $vs_label_table_name = $vn_label_table_num = $vs_label_display_name = null;
         if (method_exists($t_item, 'getLabelTableName')) {
             $t_item_label = $t_item->getLabelTableInstance();
             $vs_label_table_name = $t_item->getLabelTableName();
             $vn_label_table_num = $t_item_label->tableNum();
             $vs_label_display_name = $t_item_label->getProperty('NAME_SINGULAR');
         }
         //
         // Group data by unit
         //
         $va_grouped_data = array();
         foreach ($pa_data as $va_log_entry) {
             $va_grouped_data[$va_log_entry['unit_id']]['ca_table_num_' . $va_log_entry['logged_table_num']][] = $va_log_entry;
         }
         //
         // Process units
         //
         $va_attributes = array();
         foreach ($va_grouped_data as $vn_unit_id => $va_log_entries_by_table) {
             foreach ($va_log_entries_by_table as $vs_table_key => $va_log_entries) {
                 foreach ($va_log_entries as $va_log_entry) {
                     $va_changes = array();
                     if (!is_array($va_log_entry['snapshot'])) {
                         $va_log_entry['snapshot'] = array();
                     }
                     //
                     // Get date/time stamp for display
                     //
                     $o_tep->setUnixTimestamps($va_log_entry['log_datetime'], $va_log_entry['log_datetime']);
                     if ($this->opb_dont_show_timestamp_in_change_log) {
                         $vs_datetime = $o_tep->getText(array('timeOmit' => true));
                     } else {
                         $vs_datetime = $o_tep->getText();
                     }
                     //
                     // Get user name
                     //
                     $vs_user = $va_log_entry['fname'] . ' ' . $va_log_entry['lname'];
                     $vs_email = $va_log_entry['email'];
                     // The "logged" table/row is the row to which the change was actually applied
                     // The "subject" table/row is the row to which the change is considered to have been made for workflow purposes.
                     //
                     // For example: if an entity is related to an object, strictly speaking the logging occurs on the ca_objects_x_entities
                     // row (ca_objects_x_entities is the "logged" table), but the subject is ca_objects since it's only in the context of the
                     // object (and probably the ca_entities row as well) that you can about the change.
                     //
                     $t_obj = $o_datamodel->getInstanceByTableNum($va_log_entry['logged_table_num'], true);
                     // get instance for logged table
                     if (!$t_obj) {
                         continue;
                     }
                     $vs_subject_display_name = '???';
                     $vn_subject_row_id = null;
                     $vn_subject_table_num = null;
                     if (isset($pa_options['return_item_names']) && $pa_options['return_item_names']) {
                         if (!($vn_subject_table_num = $va_log_entry['subject_table_num'])) {
                             $vn_subject_table_num = $va_log_entry['logged_table_num'];
                             $vn_subject_row_id = $va_log_entry['logged_row_id'];
                         } else {
                             $vn_subject_row_id = $va_log_entry['subject_row_id'];
                         }
                         if ($t_subject = $o_datamodel->getInstanceByTableNum($vn_subject_table_num, true)) {
                             if ($t_subject->load($vn_subject_row_id)) {
                                 if (method_exists($t_subject, 'getLabelForDisplay')) {
                                     $vs_subject_display_name = $t_subject->getLabelForDisplay(false);
                                 } else {
                                     if ($vs_idno_field = $t_subject->getProperty('ID_NUMBERING_ID_FIELD')) {
                                         $vs_subject_display_name = $t_subject->getProperty('NAME_SINGULAR') . ' [' . $t_subject->get($vs_idno_field) . ']';
                                     } else {
                                         $vs_subject_display_name = $t_subject->getProperty('NAME_SINGULAR') . ' [' . $vn_subject_row_id . ']';
                                     }
                                 }
                             }
                         }
                     }
                     //
                     // Get item changes
                     //
                     // ---------------------------------------------------------------
                     // is this an intrinsic field?
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:ApplicationChangeLog.php


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