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


PHP get_object_by_manager_and_id函数代码示例

本文整理汇总了PHP中get_object_by_manager_and_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_object_by_manager_and_id函数的具体用法?PHP get_object_by_manager_and_id怎么用?PHP get_object_by_manager_and_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getObject

 /**
  * Return object
  *
  * @param void
  * @return ApplicationDataObject
  */
 function getObject()
 {
     if (is_null($this->object)) {
         $this->object = get_object_by_manager_and_id($this->getObjectId(), $this->getObjectManager());
     }
     return $this->object;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:13,代码来源:ObjectReminder.class.php

示例2: getObject

 /**
  * Return associated object
  *
  * @param void
  * @return ProjectDataObject
  */
 function getObject()
 {
     if (is_null($this->object)) {
         $this->object = get_object_by_manager_and_id($this->getId(), get_class($this->manager()));
     }
     // if
     return $this->object;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:14,代码来源:ObjectHandin.class.php

示例3: getOtherObject

 /**
  * Return object connected with this action, that is not equal to the one received
  *
  * @access public
  * @param  ProjectDataObject $object
  * @return ProjectDataObject
  */
 function getOtherObject($object)
 {
     if (get_class($object->manager()) != $this->getObjectManager() || $object->getObjectId() != $this->getObjectId()) {
         return get_object_by_manager_and_id($this->getObjectId(), $this->getObjectManager());
     } else {
         return get_object_by_manager_and_id($this->getRelObjectId(), $this->getRelObjectManager());
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:15,代码来源:LinkedObject.class.php

示例4: getObjectsByTemplate

 /**
  * Returns all Objects of a Template
  *
  * @param integer $template_id
  * @return array
  */
 static function getObjectsByTemplate($template_id)
 {
     $all = self::findAll(array('conditions' => array('`template_id` = ?', $template_id)));
     if (!is_array($all)) {
         return array();
     }
     $objs = array();
     foreach ($all as $obj) {
         $objs[] = get_object_by_manager_and_id($obj->getObjectId(), $obj->getObjectManager());
     }
     return $objs;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:18,代码来源:TemplateObjects.class.php

示例5: delete_tag

 /**
  * Delete tag URL
  *
  * @access public
  * @param void
  * @return null
  */
 function delete_tag()
 {
     if (!logged_user()->isAdministrator()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $tag_name = array_var($_GET, 'tag_name');
     $object_id = array_var($_GET, 'object_id');
     $manager_class = array_var($_GET, 'manager_class');
     $obj = get_object_by_manager_and_id($object_id, $manager_class);
     $obj->deleteTag($tag_name);
     $this->redirectToReferer('');
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:21,代码来源:TagController.class.php

示例6: doSearch

 /**
  * Do the search
  *
  * @param string $conditions
  * @param integer $limit
  * @param integer $offset
  * @return array
  */
 function doSearch($conditions, $limit = null, $offset = null)
 {
     $table_name = SearchableObjects::instance()->getTableName(true);
     $limit_string = '';
     if ((int) $limit > 0) {
         $offset = (int) $offset > 0 ? (int) $offset : 0;
         $limit_string = " LIMIT {$offset}, {$limit}";
     }
     // if
     $where = '';
     if (trim($conditions) != '') {
         $where = "WHERE {$conditions}";
     }
     $sql = "SELECT `rel_object_manager`, `rel_object_id` FROM {$table_name} {$where} {$limit_string}";
     $result = DB::executeAll($sql);
     if (!is_array($result)) {
         return null;
     }
     $loaded = array();
     $objects = array();
     foreach ($result as $row) {
         $manager_class = array_var($row, 'rel_object_manager');
         $object_id = array_var($row, 'rel_object_id');
         if (!isset($loaded[$manager_class . '-' . $object_id]) || !$loaded[$manager_class . '-' . $object_id]) {
             if (class_exists($manager_class)) {
                 $object = get_object_by_manager_and_id($object_id, $manager_class);
                 if ($object instanceof ProjectDataObject) {
                     $loaded[$manager_class . '-' . $object_id] = true;
                     $objects[] = $object;
                 }
                 // if
             }
             // if
         }
         // if
     }
     // foreach
     return count($objects) ? $objects : null;
 }
开发者ID:469306621,项目名称:Languages,代码行数:47,代码来源:SearchableObjects.class.php

示例7: mark_as_ham

 function mark_as_ham()
 {
     ajx_current("empty");
     $csvids = array_var($_GET, 'ids');
     $ids = explode(",", $csvids);
     $succ = 0;
     $err = 0;
     foreach ($ids as $id) {
         list($manager, $objid) = explode(":", $id);
         $mail = get_object_by_manager_and_id($objid, $manager);
         if ($mail instanceof MailContent) {
             $mail->setState(0);
             $mail->save();
             $succ++;
         } else {
             $err++;
         }
     }
     if ($err <= 0) {
         flash_success(lang('success mark as ham', $succ));
     } else {
         flash_error(lang('error mark as ham', $succ));
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:24,代码来源:MailController.class.php

示例8: getTasksAndMilestones

 private function getTasksAndMilestones($page, $objects_per_page, $tag = null, $order = null, $order_dir = null, $parent_task_id = null, $project = null, $tasksAndOrMilestones = 'both')
 {
     if (!$parent_task_id || !is_numeric($parent_task_id)) {
         $parent_task_id = 0;
     }
     $parent_string = " AND parent_id = {$parent_task_id} ";
     $queries = ObjectController::getDashboardObjectQueries($project, $tag);
     if ($tasksAndOrMilestones == 'both') {
         $query = $queries['ProjectTasks'] . $parent_string . " UNION " . $queries['ProjectMilestones'];
     } else {
         if ($tasksAndOrMilestones == 'tasks') {
             $query = $queries['ProjectTasks'] . $parent_string;
         } else {
             $query = $queries['ProjectMilestones'];
         }
     }
     if ($order) {
         $query .= " order by " . $order . " ";
         if ($order_dir) {
             $query .= " " . $order_dir . " ";
         }
     } else {
         $query .= " order by last_update desc ";
     }
     if ($page && $objects_per_page) {
         $start = ($page - 1) * $objects_per_page;
         $query .= " limit " . $start . "," . $objects_per_page . " ";
     } else {
         if ($objects_per_page) {
             $query .= " limit " . $objects_per_page;
         }
     }
     $res = DB::execute($query);
     $objects = array();
     if (!$res) {
         return $objects;
     }
     $rows = $res->fetchAll();
     if (!$rows) {
         return $objects;
     }
     $i = 1;
     foreach ($rows as $row) {
         $manager = $row['object_manager_value'];
         $id = $row['oid'];
         if ($id && $manager) {
             $obj = get_object_by_manager_and_id($id, $manager);
             if ($obj->canView(logged_user())) {
                 $dash_object = $obj->getDashboardObject();
                 //	$dash_object['id'] = $i++;
                 $objects[] = $dash_object;
             }
         }
         //if($id && $manager)
     }
     //foreach
     return $objects;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:58,代码来源:TaskController.class.php

示例9: add

 /**
  * Add comment
  * 
  * Through this controller only logged users can post (no anonymous comments here)
  *
  * @param void
  * @return null
  */
 function add()
 {
     $this->setTemplate('add_comment');
     $object_id = get_id('object_id');
     $object_manager = array_var($_GET, 'object_manager');
     if (!is_valid_function_name($object_manager)) {
         flash_error(lang('invalid request'));
         $this->redirectToUrl(active_project()->getOverviewUrl());
     }
     // if
     $object = get_object_by_manager_and_id($object_id, $object_manager);
     if (!$object instanceof ProjectDataObject || !$object->canComment(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectToUrl(active_project()->getOverviewUrl());
     }
     // if
     $comment = new Comment();
     $comment_data = array_var($_POST, 'comment');
     tpl_assign('comment_form_object', $object);
     tpl_assign('comment', $comment);
     tpl_assign('comment_data', $comment_data);
     if (is_array($comment_data)) {
         try {
             try {
                 $attached_files = ProjectFiles::handleHelperUploads(active_project());
             } catch (Exception $e) {
                 $attached_files = null;
             }
             // try
             $comment->setFromAttributes($comment_data);
             $comment->setRelObjectId($object_id);
             $comment->setRelObjectManager($object_manager);
             if (!logged_user()->isMemberOfOwnerCompany()) {
                 $comment->setIsPrivate(false);
             }
             // if
             if ($object instanceof ProjectMessage || $object instanceof ProjectFile) {
                 if ($object->getIsPrivate()) {
                     $comment->setIsPrivate(true);
                 }
                 // if
             }
             // if
             DB::beginWork();
             $comment->save();
             if (is_array($attached_files)) {
                 foreach ($attached_files as $attached_file) {
                     $comment->attachFile($attached_file);
                 }
                 // foreach
             }
             // if
             ApplicationLogs::createLog($comment, active_project(), ApplicationLogs::ACTION_ADD);
             // Subscribe user to message (if $object is message)
             if ($object instanceof ProjectMessage) {
                 if (!$object->isSubscriber(logged_user())) {
                     $object->subscribeUser(logged_user());
                 }
                 // if
             }
             // if
             DB::commit();
             flash_success(lang('success add comment'));
             $redirect_to = $comment->getViewUrl();
             if (!is_valid_url($redirect_to)) {
                 $redirect_to = $object->getViewUrl();
             }
             // if
             $this->redirectToUrl($redirect_to);
         } catch (Exception $e) {
             DB::rollback();
             tpl_assign('error', $e);
         }
         // try
     }
     // if
 }
开发者ID:ukd1,项目名称:Project-Pier,代码行数:85,代码来源:CommentController.class.php

示例10: doSearch

 /**
  * Do the search
  *
  * @param string $conditions
  * @param integer $limit
  * @param integer $offset
  * @return array
  */
 function doSearch($conditions, $limit = null, $offset = null, $search_for = '')
 {
     $table_name = SearchableObjects::instance()->getTableName(true);
     //$tags_table_name = Tags::instance()->getTableName();
     $limit_string = '';
     if ((int) $limit > 0) {
         $offset = (int) $offset > 0 ? (int) $offset : 0;
         $limit_string = " LIMIT {$offset}, {$limit}";
     }
     // if
     $where = '';
     if (trim($conditions) != '') {
         $where = "WHERE {$conditions}";
     }
     $sql = "SELECT distinct `rel_object_manager`, `rel_object_id` FROM {$table_name} {$where} ORDER BY `rel_object_id` DESC {$limit_string}";
     $result = DB::executeAll($sql);
     if (!is_array($result)) {
         return null;
     }
     $new_where = "'1' = '2' ";
     foreach ($result as $row) {
         $manager_class = array_var($row, 'rel_object_manager');
         $object_id = array_var($row, 'rel_object_id');
         $new_where .= " OR (rel_object_manager = '" . $manager_class . "' AND rel_object_id = '" . $object_id . "')";
     }
     $new_where = " AND (" . $new_where . ')';
     $sql = "SELECT `rel_object_manager`, `rel_object_id`, `column_name`, `content` FROM {$table_name} {$where} {$new_where} ORDER BY `rel_object_id`";
     $result = DB::executeAll($sql);
     if (!is_array($result)) {
         return null;
     }
     $loaded = array();
     $objects = array();
     foreach ($result as $row) {
         $manager_class = array_var($row, 'rel_object_manager');
         $object_id = array_var($row, 'rel_object_id');
         if (!isset($loaded[$manager_class . '-' . $object_id])) {
             if (class_exists($manager_class)) {
                 $object = get_object_by_manager_and_id($object_id, $manager_class);
                 if ($object instanceof ApplicationDataObject) {
                     $objects[] = array('object' => $object, 'context' => array(array('context' => SearchableObjects::getContext(array_var($row, 'content'), $search_for), 'column_name' => array_var($row, 'column_name'))));
                     $loaded[$manager_class . '-' . $object_id] = count($objects) - 1;
                 }
                 // if
             }
             // if
         } else {
             $objects[$loaded[$manager_class . '-' . $object_id]]['context'][] = array('context' => SearchableObjects::getContext(array_var($row, 'content'), $search_for), 'column_name' => array_var($row, 'column_name'));
         }
         // if
     }
     // foreach
     return count($objects) ? $objects : null;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:62,代码来源:SearchableObjects.class.php

示例11: add_to

 function add_to()
 {
     if (!can_manage_templates(logged_user())) {
         flash_error(lang("no access permissions"));
         ajx_current("empty");
         return;
     }
     $manager = array_var($_GET, 'manager');
     $id = get_id();
     $object = get_object_by_manager_and_id($id, $manager);
     $template_id = array_var($_GET, 'template');
     if ($template_id) {
         $template = COTemplates::findById($template_id);
         if ($template instanceof COTemplate) {
             try {
                 DB::beginWork();
                 $template->addObject($object);
                 DB::commit();
                 flash_success(lang('success add object to template'));
                 ajx_current("start");
             } catch (Exception $e) {
                 DB::rollback();
                 flash_error($e->getMessage());
             }
         }
     }
     tpl_assign('templates', COTemplates::findAll());
     tpl_assign("object", $object);
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:29,代码来源:TemplateController.class.php

示例12: array

            $sub_wss[] = $w;
        }
    }
}
$sub_wss_csv = array();
foreach ($sub_wss as $sub_ws) {
    $sub_wss_csv[] = $sub_ws->getId();
}
$linked_object_actions = array();
$activities = ApplicationLogs::getLastActivities($ws, active_tag(), user_config_option('activity widget elements'));
$groups = array();
$first = null;
$obj_wss_cache = array();
foreach ($activities as $act) {
    $user = Users::findById($act->getCreatedById());
    $object = get_object_by_manager_and_id($act->getRelObjectId(), $act->getRelObjectManager());
    if (!$user || !$object) {
        continue;
    }
    /*		if ($user && $object && $act->getAction() != 'login' && $act->getAction() != 'logout' 
    			&& !can_access($user, $object, ACCESS_LEVEL_READ)) continue;
    */
    $avatar_url = $user->getAvatarUrl();
    $date = $act->getCreatedOn() instanceof DateTimeValue ? friendly_date($act->getCreatedOn()) : lang('n/a');
    $dontshow = false;
    $tmp_id = '';
    if ($act->getAction() == ApplicationLogs::ACTION_LINK || $act->getAction() == ApplicationLogs::ACTION_UNLINK) {
        $tmp_id = $act->getRelObjectManager() . ":" . $act->getRelObjectId();
        foreach ($linked_object_actions as $loa) {
            if ($loa['action'] == $act->getAction() && ($loa['source'] == $tmp_id && $loa['dest'] == $act->getLogData() || $loa['source'] == $act->getLogData() && $loa['dest'] == $tmp_id)) {
                $dontshow = true;
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:widget_activity.php

示例13: getObject

 /**
  * Return object connected with this action
  *
  * @access public
  * @param void
  * @return ProjectDataObject
  */
 function getObject()
 {
     return get_object_by_manager_and_id($this->getRelObjectId(), $this->getRelObjectManager());
 }
开发者ID:469306621,项目名称:Languages,代码行数:11,代码来源:Comment.class.php

示例14: detach_from_object

 /**
  * Detach file from related object
  *
  * @param void
  * @return null
  */
 function detach_from_object()
 {
     $manager_class = array_var($_GET, 'manager');
     $object_id = get_id('object_id');
     $file_id = get_id('file_id');
     $object = get_object_by_manager_and_id($object_id, $manager_class);
     if (!$object instanceof ProjectDataObject) {
         flash_error(lang('no access permissions'));
         $this->redirectToReferer(get_url('dashboard'));
     }
     // if
     $file = ProjectFiles::findById($file_id);
     if (!$file instanceof ProjectFile) {
         flash_error(lang('file dnx'));
         $this->redirectToReferer(get_url('dashboard'));
     }
     // if
     $attached_file = AttachedFiles::findById(array('rel_object_manager' => $manager_class, 'rel_object_id' => $object_id, 'file_id' => $file_id));
     // findById
     if (!$attached_file instanceof AttachedFile) {
         flash_error(lang('file not attached to object'));
         $this->redirectToReferer(get_url('dashboard'));
     }
     // if
     try {
         DB::beginWork();
         $attached_file->delete();
         DB::commit();
         flash_success(lang('success detach file'));
     } catch (Exception $e) {
         flash_error(lang('error detach file'));
         DB::rollback();
     }
     // try
     $this->redirectToReferer($object->getObjectUrl());
 }
开发者ID:469306621,项目名称:Languages,代码行数:42,代码来源:FilesController.class.php

示例15: add_timespan

 function add_timespan()
 {
     if (!can_manage_time(logged_user(), true)) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $object_id = get_id('object_id');
     $object_manager = array_var($_GET, 'object_manager');
     if (!is_valid_function_name($object_manager)) {
         flash_error(lang('invalid request'));
         ajx_current("empty");
         return;
     }
     // if
     $object = get_object_by_manager_and_id($object_id, $object_manager);
     if (!$object instanceof ProjectDataObject || !$object->canAddTimeslot(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $timeslot_data = array_var($_POST, 'timeslot');
     $hours = array_var($timeslot_data, 'time');
     if (strpos($hours, ',') && !strpos($hours, '.')) {
         $hours = str_replace(',', '.', $hours);
     }
     $timeslot = new Timeslot();
     $dt = DateTimeValueLib::now();
     $dt2 = DateTimeValueLib::now();
     $timeslot->setEndTime($dt);
     $dt2 = $dt2->add('h', -$hours);
     $timeslot->setStartTime($dt2);
     $timeslot->setDescription(array_var($timeslot_data, 'description'));
     $timeslot->setUserId(logged_user()->getId());
     $timeslot->setObjectManager($object_manager);
     $timeslot->setObjectId($object_id);
     /* Billing */
     $billing_category_id = logged_user()->getDefaultBillingId();
     $project = $object->getProject();
     $timeslot->setBillingId($billing_category_id);
     $hourly_billing = $project->getBillingAmount($billing_category_id);
     $timeslot->setHourlyBilling($hourly_billing);
     $timeslot->setFixedBilling($hourly_billing * $hours);
     $timeslot->setIsFixedBilling(false);
     try {
         DB::beginWork();
         $timeslot->save();
         ApplicationLogs::createLog($timeslot, $timeslot->getWorkspaces(), ApplicationLogs::ACTION_OPEN);
         DB::commit();
         flash_success(lang('success create timeslot'));
         ajx_current("reload");
     } catch (Exception $e) {
         DB::rollback();
         ajx_current("empty");
         flash_error($e->getMessage());
     }
     // try
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:59,代码来源:TimeslotController.class.php


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