Exemplo n.º 1
0
 /**
  * @param AttachedObject $attachedModel
  * @return string
  */
 private function getContextForImage(AttachedObject $attachedModel)
 {
     $context = 'unknown';
     if ($this->request->getQuery('width') == 1024 && $this->request->getQuery('height') == 1024) {
         $context = 'viewer resize';
     } elseif ($this->request->getQuery('width') == 69 && $this->request->getQuery('height') == 69) {
         $context = 'list resize';
     } elseif ($this->request->getQuery('x')) {
         $context = 'inline resize';
     }
     $connector = $attachedModel->getConnector();
     if ($connector instanceof BlogPostConnector) {
         $context .= " (blog {$attachedModel->getEntityId()})";
         return $context;
     } elseif ($connector instanceof CalendarEventConnector) {
         $context .= " (calendar {$attachedModel->getEntityId()})";
         return $context;
     } elseif ($connector instanceof ForumMessageConnector) {
         $context .= " (forum {$attachedModel->getEntityId()})";
         return $context;
     } elseif ($connector instanceof SonetCommentConnector) {
         $context .= " (sonetcomm {$attachedModel->getEntityId()})";
         return $context;
     } elseif ($connector instanceof SonetLogConnector) {
         $context .= " (sonetlog {$attachedModel->getEntityId()})";
         return $context;
     } elseif ($connector instanceof TaskConnector) {
         $context .= " (task {$attachedModel->getEntityId()})";
         return $context;
     } else {
         $context .= " (stub {$attachedModel->getEntityId()})";
         return $context;
     }
 }
Exemplo n.º 2
0
 /**
  * Checks attitude attached object to entity. It is important in right checking in components disk.uf.file, disk.uf.version.
  * @param AttachedObject $attachedObject Attached object.
  * @param string $entityType Entity type (ex. sonet_comment).
  * @param int $entityId Id of entity.
  * @return bool
  */
 public function belongsToEntity(AttachedObject $attachedObject, $entityType, $entityId)
 {
     list($connectorClass, $moduleId) = $this->getConnectorDataByEntityType($entityType);
     return $attachedObject->getEntityId() == $entityId && $attachedObject->getModuleId() == $moduleId && $attachedObject->getEntityType() == $connectorClass;
 }