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


PHP Objects::findObject方法代码示例

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


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

示例1: getObject

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

示例2: rebuild

 public function rebuild($start_date = null, $end_date = null)
 {
     if (!$start_date) {
         $start_date = config_option('last_sharing_table_rebuild');
     }
     if ($start_date instanceof DateTimeValue) {
         $start_date = $start_date->toMySQL();
     }
     if ($end_date instanceof DateTimeValue) {
         $end_date = $end_date->toMySQL();
     }
     if ($end_date) {
         $end_cond = "AND updated_on <= '{$end_date}'";
     }
     try {
         $object_ids = Objects::instance()->findAll(array('id' => true, "conditions" => "updated_on >= '{$start_date}' {$end_cond}"));
         $obj_count = 0;
         DB::beginWork();
         foreach ($object_ids as $id) {
             $obj = Objects::findObject($id);
             if ($obj instanceof ContentDataObject) {
                 $obj->addToSharingTable();
                 $obj_count++;
             }
         }
         set_config_option('last_sharing_table_rebuild', DateTimeValueLib::now()->toMySQL());
         DB::commit();
     } catch (Exception $e) {
         DB::rollback();
         Logger::log("Failed to rebuild sharing table: " . $e->getMessage() . "\nTrace: " . $e->getTraceAsString());
     }
     return $obj_count;
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:33,代码来源:SharingTables.class.php

示例3: purge_trash

 function purge_trash()
 {
     Env::useHelper("permissions");
     $days = config_option("days_on_trash", 0);
     $count = 0;
     if ($days > 0) {
         $date = DateTimeValueLib::now()->add("d", -$days);
         $objects = Objects::findAll(array("conditions" => array("`trashed_by_id` > 0 AND `trashed_on` < ?", $date), "limit" => 100));
         foreach ($objects as $object) {
             $concrete_object = Objects::findObject($object->getId());
             if (!$concrete_object instanceof ContentDataObject) {
                 continue;
             }
             if ($concrete_object instanceof MailContent && $concrete_object->getIsDeleted() > 0) {
                 continue;
             }
             try {
                 DB::beginWork();
                 if ($concrete_object instanceof MailContent) {
                     $concrete_object->delete(false);
                 } else {
                     $concrete_object->delete();
                 }
                 ApplicationLogs::createLog($concrete_object, ApplicationLogs::ACTION_DELETE);
                 DB::commit();
                 $count++;
             } catch (Exception $e) {
                 DB::rollback();
                 Logger::log("Error delting object in purge_trash: " . $e->getMessage(), Logger::ERROR);
             }
         }
     }
     return $count;
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:34,代码来源:Trash.class.php

示例4: 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 (($object->getObjectId()!= $this->getObjectId()) ) {
   		return Objects::findObject($this->getObjectId());
   } else {
   		return Objects::findObject($this->getRelObjectId());
   }
 } // getObject
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:14,代码来源:LinkedObject.class.php

示例5: mail_do_mark_as_read_unread_objects

function mail_do_mark_as_read_unread_objects($ids_to_mark, $read)
{
    $all_accounts = array();
    $all_accounts_ids = array();
    foreach ($ids_to_mark as $id) {
        $obj = Objects::findObject($id);
        if ($obj instanceof MailContent && logged_user() instanceof Contact) {
            //conversation set the rest of the conversation
            $uds_to_mark_from_conver = array();
            if (user_config_option('show_emails_as_conversations')) {
                $emails_in_conversation = MailContents::getMailsFromConversation($obj);
                foreach ($emails_in_conversation as $email) {
                    //$id is marked on object controller only mark the rest of the conversation
                    if ($id != $email->getId()) {
                        $email->setIsRead(logged_user()->getId(), $read);
                        $uds_to_mark_from_conver[] = $email->getUid();
                    }
                }
            }
            //make the array with accounts and uids to send to the mail server
            //accounts
            if (!in_array($obj->getAccountId(), $all_accounts_ids)) {
                $account = $obj->getAccount();
                //if logged user is owner of this account and is imap
                if ($account instanceof MailAccount && $account->getContactId() == logged_user()->getId() && $account->getIsImap()) {
                    $all_accounts_ids[] = $obj->getAccountId();
                    $all_accounts[$account->getId()]['account'] = $account;
                }
            }
            //uids
            if (in_array($obj->getAccountId(), $all_accounts_ids)) {
                //add conversations uids
                //mientras ande mal el uid de los mails enviados si estan sincronizados no usar esta parte
                /*if (user_config_option('show_emails_as_conversations')) {
                			foreach ($uds_to_mark_from_conver as $uid_conver){
                				$all_accounts[$obj->getAccountId()]['uids'][] = $uid_conver;
                			}
                		}*/
                $all_accounts[$obj->getAccountId()]['folders'][$obj->getImapFolderName()][] = $obj->getUid();
            }
        }
    }
    //foreach account send uids by folder to mark in the mail server
    foreach ($all_accounts as $account_data) {
        $account = $account_data['account'];
        $folders = $account_data['folders'];
        foreach ($folders as $key => $folder) {
            $folder_name = $key;
            $uids = $folder;
            if (!empty($folder_name)) {
                try {
                    MailUtilities::setReadUnreadImapMails($account, $folder_name, $uids, $read);
                } catch (Exception $e) {
                    Logger::log("Could not set mail as read on mail server, exception:\n" . $e->getMessage());
                }
            }
        }
    }
}
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:59,代码来源:mail_hooks.php

示例6: 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[] = Objects::findObject($obj->getObjectId());
		
		}
		
		return $objs;
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:17,代码来源:TemplateObjects.class.php

示例7: healPermissionGroup

 function healPermissionGroup(SharingTableFlag $flag)
 {
     if ($flag->getObjectId() > 0) {
         try {
             $obj = Objects::findObject($flag->getObjectId());
             if (!$obj instanceof ContentDataObject) {
                 $flag->delete();
                 // if object does not exists then delete the flag
                 return;
             }
             DB::beginWork();
             // update sharing table
             $obj->addToSharingTable();
             DB::commit();
         } catch (Exception $e) {
             DB::rollback();
             Logger::log("Failed to heal object permissions for object " . $flag->getObjectId() . " (flag_id = " . $flag->getId() . ")");
             return false;
         }
         // delete flag
         $flag->delete();
         return true;
     } else {
         // heal
         $controller = new SharingTableController();
         $permissions_string = $flag->getPermissionString();
         $permission_group_id = $flag->getPermissionGroupId();
         $permissions = json_decode($permissions_string);
         if ($flag->getMemberId() > 0) {
             foreach ($permissions as $p) {
                 if (!isset($p->m)) {
                     $p->m = $flag->getMemberId();
                 }
             }
         }
         try {
             DB::beginWork();
             // update sharing table
             $controller->afterPermissionChanged($permission_group_id, $permissions);
             DB::commit();
         } catch (Exception $e) {
             DB::rollback();
             Logger::log("Failed to heal permission group {$permission_group_id} (flag_id = " . $flag->getId() . ")\n" . $e->getTraceAsString());
             return false;
         }
         // delete flag
         $flag->delete();
         return true;
     }
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:50,代码来源:SharingTableFlags.class.php

示例8: 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) {
         $o = Objects::findObject($obj->getObjectId());
         if ($o instanceof ContentDataObject) {
             $objs[] = $o;
         }
     }
     return $objs;
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:21,代码来源:TemplateObjects.class.php

示例9: workspaces_quickadd_extra_fields

function workspaces_quickadd_extra_fields($parameters) {
	if (array_var($parameters, 'dimension_id') == Dimensions::findByCode("workspaces")->getId()) {
		$parent_member = Members::findById(array_var($parameters, 'parent_id'));
		if ($parent_member instanceof Member && $parent_member->getObjectId() > 0) {
			$dimension_object = Objects::findObject($parent_member->getObjectId());
			
			$fields = $dimension_object->manager()->getPublicColumns();
			$color_columns = array();
			foreach ($fields as $f) {
				if ($f['type'] == DATA_TYPE_WSCOLOR) {
					$color_columns[] = $f['col'];
				}
			}
			foreach ($color_columns as $col) {
				foreach ($fields as &$f) {
					if ($f['col'] == $col && $dimension_object->columnExists($col)) {
						$color_code = $dimension_object->getColumnValue($col);
						echo '<input type="hidden" name="dim_obj['.$col.']" value="'.$color_code.'" />';
					}
				}
			}
		}
	}
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:24,代码来源:workspaces_hooks.php

示例10: getActivityData

 function getActivityData()
 {
     $user = Contacts::findById($this->getCreatedById());
     $object = Objects::findObject($this->getRelObjectId());
     if (!$user) {
         return false;
     }
     $icon_class = "";
     if ($object instanceof ProjectFile) {
         $path = explode("-", str_replace(".", "_", str_replace("/", "-", $object->getTypeString())));
         $acc = "";
         foreach ($path as $p) {
             $acc .= $p;
             $icon_class .= ' ico-' . $acc;
             $acc .= "-";
         }
     }
     // Build data depending on type
     if ($object) {
         if ($object instanceof Contact && $object->isUser()) {
             $type = "user";
         } else {
             $type = $object->getObjectTypeName();
         }
         $object_link = '<a style="font-weight:bold" href="' . $object->getObjectUrl() . '">&nbsp;' . '<span style="padding: 1px 0 3px 18px;" class="db-ico ico-unknown ico-' . $type . $icon_class . '"/>' . clean($object->getObjectName()) . '</a>';
     } else {
         $object_link = clean($this->getObjectName()) . '&nbsp;' . lang('object is deleted');
     }
     switch ($this->getAction()) {
         case ApplicationLogs::ACTION_EDIT:
         case ApplicationLogs::ACTION_ADD:
         case ApplicationLogs::ACTION_DELETE:
         case ApplicationLogs::ACTION_TRASH:
         case ApplicationLogs::ACTION_UNTRASH:
         case ApplicationLogs::ACTION_OPEN:
         case ApplicationLogs::ACTION_CLOSE:
         case ApplicationLogs::ACTION_ARCHIVE:
         case ApplicationLogs::ACTION_UNARCHIVE:
         case ApplicationLogs::ACTION_READ:
         case ApplicationLogs::ACTION_DOWNLOAD:
         case ApplicationLogs::ACTION_CHECKIN:
         case ApplicationLogs::ACTION_CHECKOUT:
             if ($object) {
                 return lang('activity ' . $this->getAction(), lang('the ' . $type), $user->getDisplayName(), $object_link);
             }
         case ApplicationLogs::ACTION_SUBSCRIBE:
         case ApplicationLogs::ACTION_UNSUBSCRIBE:
             $user_ids = explode(",", $this->getLogData());
             if (count($user_ids) < 8) {
                 $users_str = "";
                 foreach ($user_ids as $usid) {
                     $su = Contacts::findById($usid);
                     if ($su instanceof Contact) {
                         $users_str .= '<a style="font-weight:bold" href="' . $su->getObjectUrl() . '">&nbsp;<span style="padding: 0 0 3px 18px;" class="db-ico ico-unknown ico-user"/>' . clean($su->getObjectName()) . '</a>, ';
                     }
                 }
                 if (count($user_ids) == 1) {
                     $users_text = substr(trim($users_str), 0, -1);
                 } else {
                     $users_text = lang('x users', count($user_ids), ": {$users_str}");
                 }
             } else {
                 $users_text = lang('x users', count($user_ids), "");
             }
             if ($object) {
                 return lang('activity ' . $this->getAction(), lang('the ' . $object->getObjectTypeName()), $user->getDisplayName(), $object_link, $users_text);
             }
         case ApplicationLogs::ACTION_COMMENT:
             if ($object) {
                 return lang('activity ' . $this->getAction(), lang('the ' . $object->getRelObject()->getObjectTypeName()), $user->getDisplayName(), $object_link, $this->getLogData());
             }
         case ApplicationLogs::ACTION_LINK:
         case ApplicationLogs::ACTION_UNLINK:
             $exploded = explode(":", $this->getLogData());
             $linked_object = Objects::findObject($exploded[1]);
             if ($linked_object instanceof ApplicationDataObject) {
                 $icon_class = "";
                 if ($linked_object instanceof ProjectFile) {
                     $path = explode("-", str_replace(".", "_", str_replace("/", "-", $linked_object->getTypeString())));
                     $acc = "";
                     foreach ($path as $p) {
                         $acc .= $p;
                         $icon_class .= ' ico-' . $acc;
                         $acc .= "-";
                     }
                 }
                 $linked_object_link = '<a style="font-weight:bold" href="' . $linked_object->getObjectUrl() . '">&nbsp;<span style="padding: 1px 0 3px 18px;" class="db-ico ico-unknown ico-' . $linked_object->getObjectTypeName() . $icon_class . '"/>' . clean($linked_object->getObjectName()) . '</a>';
             } else {
                 $linked_object_link = '';
             }
             if ($object) {
                 return lang('activity ' . $this->getAction(), lang('the ' . $object->getObjectTypeName()), $user->getDisplayName(), $object_link, $linked_object instanceof ApplicationDataObject ? lang('the ' . $linked_object->getObjectTypeName()) : '', $linked_object_link);
             }
         case ApplicationLogs::ACTION_LOGIN:
         case ApplicationLogs::ACTION_LOGOUT:
             return lang('activity ' . $this->getAction(), $user->getDisplayName());
             /*FIXME when D&D is implemented case ApplicationLogs::ACTION_MOVE :
             			$exploded = explode(";", $this->getLogData());
             			$to_str = "";
             			$from_str = "";
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:ApplicationLog.class.php

示例11: re_render_custom_properties

 function re_render_custom_properties()
 {
     $object = Objects::findObject(array_var($_GET, 'id'));
     if (!$object) {
         // if id == 0 object is new, then a dummy object is created to render the properties.
         $object = new ProjectMessage();
     }
     $html = render_object_custom_properties($object, array_var($_GET, 'req'), array_var($_GET, 'co_type'));
     $scripts = array();
     $initag = "<script>";
     $endtag = "</script>";
     $pos = strpos($html, $initag);
     while ($pos !== FALSE) {
         $end_pos = strpos($html, $endtag, $pos);
         if ($end_pos === FALSE) {
             break;
         }
         $ini = $pos + strlen($initag);
         $sc = substr($html, $ini, $end_pos - $ini);
         if (!str_starts_with(trim($sc), "og.addTableCustomPropertyRow")) {
             // do not add repeated functions
             $scripts[] = $sc;
         }
         $pos = strpos($html, $initag, $end_pos);
     }
     foreach ($scripts as $sc) {
         $html = str_replace("{$initag}{$sc}{$endtag}", "", $html);
     }
     ajx_current("empty");
     ajx_extra_data(array("html" => $html, 'scripts' => implode("", $scripts)));
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:31,代码来源:ObjectController.class.php

示例12: quick_add_files

	function quick_add_files() {
		if (logged_user()->isGuest()) {
			flash_error(lang('no access permissions'));
			ajx_current("empty");
			return;
		}
		$file_data = array_var($_POST, 'file');

		$file = new ProjectFile();
			
		tpl_assign('file', $file);
		tpl_assign('file_data', $file_data);
		tpl_assign('genid', array_var($_GET, 'genid'));
                tpl_assign('object_id', array_var($_GET, 'object_id'));
			
		if (is_array(array_var($_POST, 'file'))) {
			//$this->setLayout("html");
			$upload_option = array_var($file_data, 'upload_option');
			try {
				DB::beginWork();
				
				$type = array_var($file_data, 'type');
				$file->setType($type);
				$file->setFilename(array_var($file_data, 'name'));
				$file->setFromAttributes($file_data);
				
				$file->setIsVisible(true);
				
				$file->save();
				$file->subscribeUser(logged_user());
					
				if($file->getType() == ProjectFiles::TYPE_DOCUMENT){
					// handle uploaded file
					$upload_id = array_var($file_data, 'upload_id');
					$uploaded_file = array_var($_SESSION, $upload_id, array());
					$revision = $file->handleUploadedFile($uploaded_file, true); // handle uploaded file
					@unlink($uploaded_file['tmp_name']);
					unset($_SESSION[$upload_id]);
				} else if ($file->getType() == ProjectFiles::TYPE_WEBLINK) {
					$url = array_var($file_data, 'url', '');
					if ($url && strpos($url, ':') === false) {
						$url = $this->protocol . $url;
						$file->setUrl($url);
						$file->save();
					}
					$revision = new ProjectFileRevision();
					$revision->setFileId($file->getId());
					$revision->setRevisionNumber($file->getNextRevisionNumber());
					$revision->setFileTypeId(FileTypes::getByExtension('webfile')->getId());
					$revision->setTypeString($file->getUrl());
					$revision->setRepositoryId('webfile');
					$revision_comment = array_var($file_data, 'revision_comment', lang('initial versions'));
					$revision->setComment($revision_comment);
					$revision->save();
				}

				$member_ids = array();
				$object_controller = new ObjectController();
				if(count(active_context_members(false)) > 0 ){
					$object_controller->add_to_members($file, active_context_members(false));
				}elseif(array_var($file_data, 'object_id')){
					$object = Objects::findObject(array_var($file_data, 'object_id'));
					if ($object instanceof ContentDataObject) {
						$member_ids = $object->getMemberIds();
						$object_controller->add_to_members($file, $member_ids);
					} else {
						// add only to logged_user's person member
						$object_controller->add_to_members($file, array());
					}
				} else {
					// add only to logged_user's person member
					$object_controller->add_to_members($file, array());
				}
				
				DB::commit();
				
				ajx_extra_data(array("file_id" => $file->getId()));
				ajx_extra_data(array("file_name" => $file->getFilename()));
				ajx_extra_data(array("icocls" => 'ico-file ico-' . str_replace(".", "_", str_replace("/", "-", $file->getTypeString()))));

				if (!array_var($_POST, 'no_msg')) {
					flash_success(lang('success add file', $file->getFilename()));
				}
				ajx_current("empty");
				
			} catch(Exception $e) {
				DB::rollback();
				flash_error($e->getMessage());
				ajx_current("empty");

				// If we uploaded the file remove it from repository
				if(isset($revision) && ($revision instanceof ProjectFileRevision) && FileRepository::isInRepository($revision->getRepositoryId())) {
					FileRepository::deleteFile($revision->getRepositoryId());
				} // if
			} // try
		} // if
	} // quick_add_files
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:97,代码来源:FilesController.class.php

示例13: 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 = Objects::findObject($id);
     $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:rorteg,项目名称:fengoffice,代码行数:29,代码来源:TemplateController.class.php

示例14: explode

<?php    
    $options = explode(",",user_config_option("filters_dashboard"));
    
    $activities =  ApplicationLogs::getLastActivities();
    $limit = $options[2];
    $acts = array();
    $acts['data'] = array();
    foreach($activities as $activity){
        $user = Contacts::findById($activity->getCreatedById());
        if ($activity->getLogData() == 'member deleted') {
        	$object = Members::findById($activity->getRelObjectId());
        	$member_deleted = true;
        } else {
        	$object = Objects::findObject($activity->getRelObjectId());
        }
        
        if($object || $member_deleted){
            $key = $activity->getRelObjectId() . "-" . $activity->getCreatedById();

            if(count($acts['data']) < ($limit*2)){
                if(!array_key_exists($key, $acts['data'])){
                    $acts['data'][$key] = $object;
                    $acts['created_by'][$key] = $user;
                    $acts['act_data'][$key] = $activity->getActivityDataView($user,$object);
                    $acts['date'][$key] = $activity->getCreatedOn() instanceof DateTimeValue ? friendly_date($activity->getCreatedOn()) : lang('n/a');
                }else{
                    $acts['data'][$key] = $object;
                    $acts['created_by'][$key] = $user;
                    $acts['act_data'][$key] = $activity->getActivityDataView($user,$object,true);
                    $acts['date'][$key] = $activity->getCreatedOn() instanceof DateTimeValue ? friendly_date($activity->getCreatedOn()) : lang('n/a');
                }            
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:index.php

示例15: trash

 private function trash($request)
 {
     $response = false;
     if ($id = $request['id']) {
         if ($object = Objects::findObject($id)) {
             if ($object->canDelete(logged_user())) {
                 try {
                     $object->trash();
                     Hook::fire('after_object_trash', $object, $null);
                     $response = true;
                 } catch (Exception $e) {
                     $response = false;
                 }
             }
         }
     }
     return $this->response('json', $response);
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:18,代码来源:ApiController.class.php


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