本文整理汇总了PHP中Objects::getObjectsFromContext方法的典型用法代码示例。如果您正苦于以下问题:PHP Objects::getObjectsFromContext方法的具体用法?PHP Objects::getObjectsFromContext怎么用?PHP Objects::getObjectsFromContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Objects
的用法示例。
在下文中一共展示了Objects::getObjectsFromContext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list_objects
function list_objects()
{
//alert("debugging. remove this line");ajx_current('empty'); return array() ; //TODO remove this line
/* get query parameters */
$filesPerPage = config_option('files_per_page');
$start = array_var($_GET, 'start') ? (int) array_var($_GET, 'start') : 0;
$limit = array_var($_GET, 'limit') ? array_var($_GET, 'limit') : $filesPerPage;
$order = array_var($_GET, 'sort');
$ignore_context = (bool) array_var($_GET, 'ignore_context');
if ($order == "dateUpdated") {
$order = "updated_on";
} elseif ($order == "dateArchived") {
$order = "archived_on";
} elseif ($order == "dateDeleted") {
$order = "trashed_on";
}
$orderdir = array_var($_GET, 'dir');
$page = (int) ($start / $limit) + 1;
$hide_private = !logged_user()->isMemberOfOwnerCompany();
$typeCSV = array_var($_GET, 'type');
$types = null;
if ($typeCSV) {
$types = explode(",", $typeCSV);
}
$name_filter = mysql_escape_string(array_var($_GET, 'name'));
$linked_obj_filter = array_var($_GET, 'linkedobject');
$object_ids_filter = '';
if (!is_null($linked_obj_filter)) {
$linkedObject = Objects::findObject($linked_obj_filter);
$objs = $linkedObject->getLinkedObjects();
foreach ($objs as $obj) {
$object_ids_filter .= ($object_ids_filter == '' ? '' : ',') . $obj->getId();
}
}
$filters = array();
if (!is_null($types)) {
$filters['types'] = $types;
}
if (!is_null($name_filter)) {
$filters['name'] = $name_filter;
}
if ($object_ids_filter != '') {
$filters['object_ids'] = $object_ids_filter;
}
$user = array_var($_GET, 'user');
$trashed = array_var($_GET, 'trashed', false);
$archived = array_var($_GET, 'archived', false);
/* if there's an action to execute, do so */
if (array_var($_GET, 'action') == 'delete') {
$ids = explode(',', array_var($_GET, 'objects'));
$result = ContentDataObjects::listing(array("extra_conditions" => " AND o.id IN (" . implode(",", $ids) . ") ", "include_deleted" => true));
$objects = $result->objects;
list($succ, $err) = $this->do_delete_objects($objects);
if ($err > 0) {
flash_error(lang('error delete objects', $err));
} else {
Hook::fire('after_object_delete_permanently', $ids, $ignored);
flash_success(lang('success delete objects', $succ));
}
} else {
if (array_var($_GET, 'action') == 'delete_permanently') {
$ids = explode(',', array_var($_GET, 'objects'));
//$result = Objects::getObjectsFromContext(active_context(), null, null, true, false, array('object_ids' => implode(",",$ids)));
$objects = Objects::instance()->findAll(array("conditions" => "id IN (" . implode(",", $ids) . ")"));
list($succ, $err) = $this->do_delete_objects($objects, true);
if ($err > 0) {
flash_error(lang('error delete objects', $err));
}
if ($succ > 0) {
Hook::fire('after_object_delete_permanently', $ids, $ignored);
flash_success(lang('success delete objects', $succ));
}
} else {
if (array_var($_GET, 'action') == 'markasread') {
$ids = explode(',', array_var($_GET, 'objects'));
list($succ, $err) = $this->do_mark_as_read_unread_objects($ids, true);
} else {
if (array_var($_GET, 'action') == 'markasunread') {
$ids = explode(',', array_var($_GET, 'objects'));
list($succ, $err) = $this->do_mark_as_read_unread_objects($ids, false);
} else {
if (array_var($_GET, 'action') == 'empty_trash_can') {
$result = Objects::getObjectsFromContext(active_context(), 'trashed_on', 'desc', true);
$objects = $result->objects;
list($succ, $err) = $this->do_delete_objects($objects, true);
if ($err > 0) {
flash_error(lang('error delete objects', $err));
}
if ($succ > 0) {
flash_success(lang('success delete objects', $succ));
}
} else {
if (array_var($_GET, 'action') == 'archive') {
$ids = explode(',', array_var($_GET, 'objects'));
list($succ, $err) = $this->do_archive_unarchive_objects($ids, 'archive');
if ($err > 0) {
flash_error(lang('error archive objects', $err));
} else {
flash_success(lang('success archive objects', $succ));
}
//.........这里部分代码省略.........
示例2: activity_feed
/**
*
*
*/
public function activity_feed()
{
ajx_set_no_back(true);
require_javascript("og/modules/dashboardComments.js");
require_javascript("jquery/jquery.scrollTo-min.js");
/* get query parameters */
$filesPerPage = config_option('files_per_page');
$start = array_var($_GET, 'start') ? (int) array_var($_GET, 'start') : 0;
$limit = array_var($_GET, 'limit') ? array_var($_GET, 'limit') : $filesPerPage;
$order = array_var($_GET, 'sort');
$orderdir = array_var($_GET, 'dir');
$page = (int) ($start / $limit) + 1;
$hide_private = !logged_user()->isMemberOfOwnerCompany();
$typeCSV = array_var($_GET, 'type');
$types = null;
if ($typeCSV) {
$types = explode(",", $typeCSV);
}
$name_filter = array_var($_GET, 'name');
$linked_obj_filter = array_var($_GET, 'linkedobject');
$object_ids_filter = '';
if (!is_null($linked_obj_filter)) {
$linkedObject = Objects::findObject($linked_obj_filter);
$objs = $linkedObject->getLinkedObjects();
foreach ($objs as $obj) {
$object_ids_filter .= ($object_ids_filter == '' ? '' : ',') . $obj->getId();
}
}
$filters = array();
if (!is_null($types)) {
$filters['types'] = $types;
}
if (!is_null($name_filter)) {
$filters['name'] = $name_filter;
}
if ($object_ids_filter != '') {
$filters['object_ids'] = $object_ids_filter;
}
$user = array_var($_GET, 'user');
$trashed = array_var($_GET, 'trashed', false);
$archived = array_var($_GET, 'archived', false);
/* if there's an action to execute, do so */
if (array_var($_GET, 'action') == 'delete') {
$ids = explode(',', array_var($_GET, 'objects'));
$result = Objects::getObjectsFromContext(active_context(), null, null, false, false, array('object_ids' => implode(",", $ids)));
$objects = $result->objects;
list($succ, $err) = $this->do_delete_objects($objects);
if ($err > 0) {
flash_error(lang('error delete objects', $err));
} else {
flash_success(lang('success delete objects', $succ));
}
} else {
if (array_var($_GET, 'action') == 'delete_permanently') {
$ids = explode(',', array_var($_GET, 'objects'));
$result = Objects::getObjectsFromContext(active_context(), null, null, true, false, array('object_ids' => implode(",", $ids)));
$objects = $result->objects;
list($succ, $err) = $this->do_delete_objects($objects, true);
if ($err > 0) {
flash_error(lang('error delete objects', $err));
}
if ($succ > 0) {
flash_success(lang('success delete objects', $succ));
}
} else {
if (array_var($_GET, 'action') == 'markasread') {
$ids = explode(',', array_var($_GET, 'objects'));
list($succ, $err) = $this->do_mark_as_read_unread_objects($ids, true);
} else {
if (array_var($_GET, 'action') == 'markasunread') {
$ids = explode(',', array_var($_GET, 'objects'));
list($succ, $err) = $this->do_mark_as_read_unread_objects($ids, false);
} else {
if (array_var($_GET, 'action') == 'empty_trash_can') {
$result = Objects::getObjectsFromContext(active_context(), 'trashed_on', 'desc', true);
$objects = $result->objects;
list($succ, $err) = $this->do_delete_objects($objects, true);
if ($err > 0) {
flash_error(lang('error delete objects', $err));
}
if ($succ > 0) {
flash_success(lang('success delete objects', $succ));
}
} else {
if (array_var($_GET, 'action') == 'archive') {
$ids = explode(',', array_var($_GET, 'objects'));
list($succ, $err) = $this->do_archive_unarchive_objects($ids, 'archive');
if ($err > 0) {
flash_error(lang('error archive objects', $err));
} else {
flash_success(lang('success archive objects', $succ));
}
} else {
if (array_var($_GET, 'action') == 'unarchive') {
$ids = explode(',', array_var($_GET, 'objects'));
list($succ, $err) = $this->do_archive_unarchive_objects($ids, 'unarchive');
//.........这里部分代码省略.........