Example #1
0
 /**
  * return all replies on a specific ticket.
  * @param $ticket_id the id of the ticket of which we want the replies.
  * @param $view_as_admin if the browsing user is an admin/mod it should be 1, this will also show the hidden replies.
  * @return an array with ticket_reply objects (beware the author and content are objects on their own, not integers!)
  */
 public static function getRepliesOfTicket($ticket_id, $view_as_admin)
 {
     $dbl = new DBLayer("lib");
     $statement = $dbl->execute("SELECT * FROM ticket_reply INNER JOIN ticket_content INNER JOIN ticket_user ON ticket_reply.Content = ticket_content.TContentId and ticket_reply.Ticket=:id and ticket_user.TUserId = ticket_reply.Author ORDER BY ticket_reply.TReplyId ASC", array('id' => $ticket_id));
     $row = $statement->fetchAll();
     $result = array();
     foreach ($row as $tReply) {
         //only add hidden replies if the user is a mod/admin
         if (!$tReply['Hidden'] || $view_as_admin) {
             //load author
             $instanceAuthor = Ticket_User::constr_TUserId($tReply['Author']);
             $instanceAuthor->setExternId($tReply['ExternId']);
             $instanceAuthor->setPermission($tReply['Permission']);
             //load content
             $instanceContent = new Ticket_Content();
             $instanceContent->setTContentId($tReply['TContentId']);
             $instanceContent->setContent($tReply['Content']);
             //load reply and add the author and content object in it.
             $instanceReply = new self();
             $instanceReply->setTReplyId($tReply['TReplyId']);
             $instanceReply->setTimestamp($tReply['Timestamp']);
             $instanceReply->setAuthor($instanceAuthor);
             $instanceReply->setTicket($ticket_id);
             $instanceReply->setContent($instanceContent);
             $instanceReply->setHidden($tReply['Hidden']);
             $result[] = $instanceReply;
         }
     }
     return $result;
 }
 /**
  * Read from a file
  *
  * @deprecated  Use img.io.MetaDataReader instead
  * @param   io.File file
  * @param   var default default void what should be returned in case no data is found
  * @return  img.util.IptcData
  * @throws  lang.FormatException in case malformed meta data is encountered
  * @throws  lang.ElementNotFoundException in case no meta data is available
  * @throws  img.ImagingException in case reading meta data fails
  */
 public static function fromFile(File $file)
 {
     if (FALSE === getimagesize($file->getURI(), $info)) {
         $e = new ImagingException('Cannot read image information from ' . $file->getURI());
         xp::gc(__FILE__);
         throw $e;
     }
     if (!isset($info['APP13'])) {
         if (func_num_args() > 1) {
             return func_get_arg(1);
         }
         throw new ElementNotFoundException('Cannot get IPTC information from ' . $file->getURI() . ' (no APP13 marker)');
     }
     if (!($iptc = iptcparse($info['APP13']))) {
         throw new FormatException('Cannot parse IPTC information from ' . $file->getURI());
     }
     // Parse creation date
     if (3 == sscanf(@$iptc['2#055'][0], '%4d%2d%d', $year, $month, $day)) {
         $created = Date::create($year, $month, $day, 0, 0, 0);
     } else {
         $created = NULL;
     }
     with($i = new self());
     $i->setTitle(@$iptc['2#005'][0]);
     $i->setUrgency(@$iptc['2#010'][0]);
     $i->setCategory(@$iptc['2#015'][0]);
     $i->setSupplementalCategories(@$iptc['2#020']);
     $i->setKeywords(@$iptc['2#025']);
     $i->setSpecialInstructions(@$iptc['2#040'][0]);
     $i->setDateCreated($created);
     $i->setAuthor(@$iptc['2#080'][0]);
     $i->setAuthorPosition(@$iptc['2#085'][0]);
     $i->setCity(@$iptc['2#090'][0]);
     $i->setState(@$iptc['2#095'][0]);
     $i->setCountry(@$iptc['2#101'][0]);
     $i->setOriginalTransmissionReference(@$iptc['2#103'][0]);
     $i->setHeadline(@$iptc['2#105'][0]);
     $i->setCredit(@$iptc['2#110'][0]);
     $i->setSource(@$iptc['2#115'][0]);
     $i->setCopyrightNotice(@$iptc['2#116'][0]);
     $i->setCaption(@$iptc['2#120'][0]);
     $i->setWriter(@$iptc['2#122'][0]);
     return $i;
 }
Example #3
0
 /**
  * return all log entries related to a ticket.
  * @param $ticket_id the id of the ticket of which we want all related log entries returned.
  * @return an array of ticket_log objects, be aware that the author in the ticket_log object is a ticket_user object on its own (so not a simple integer).
  */
 public static function getLogsOfTicket($ticket_id)
 {
     $dbl = new DBLayer("lib");
     $statement = $dbl->execute("SELECT * FROM ticket_log INNER JOIN ticket_user ON ticket_log.Author = ticket_user.TUserId and ticket_log.Ticket=:id ORDER BY ticket_log.TLogId ASC", array('id' => $ticket_id));
     $row = $statement->fetchAll();
     $result = array();
     foreach ($row as $log) {
         $instanceAuthor = Ticket_User::constr_TUserId($log['Author']);
         $instanceAuthor->setExternId($log['ExternId']);
         $instanceAuthor->setPermission($log['Permission']);
         $instanceLog = new self();
         $instanceLog->setTLogId($log['TLogId']);
         $instanceLog->setTimestamp($log['Timestamp']);
         $instanceLog->setAuthor($instanceAuthor);
         $instanceLog->setTicket($ticket_id);
         $instanceLog->setQuery($log['Query']);
         $result[] = $instanceLog;
     }
     return $result;
 }
Example #4
0
 public static function construct($_arrayMarket)
 {
     $market = new self();
     if (!isset($_arrayMarket['id'])) {
         return;
     }
     $market->setId($_arrayMarket['id']);
     $market->setName($_arrayMarket['name']);
     $market->setType($_arrayMarket['type']);
     $market->datetime = json_encode($_arrayMarket['datetime'], JSON_UNESCAPED_UNICODE);
     $market->setDescription($_arrayMarket['description']);
     $market->setDownloaded($_arrayMarket['downloaded']);
     $market->setUser_id($_arrayMarket['user_id']);
     $market->setVersion($_arrayMarket['version']);
     $market->setCategorie($_arrayMarket['categorie']);
     $market->status = json_encode($_arrayMarket['status'], JSON_UNESCAPED_UNICODE);
     $market->setAuthor($_arrayMarket['author']);
     $market->setChangelog($_arrayMarket['changelog']);
     $market->setLogicalId($_arrayMarket['logicalId']);
     $market->setUtilization($_arrayMarket['utilization']);
     $market->setCertification($_arrayMarket['certification']);
     $market->setPurchase($_arrayMarket['purchase']);
     $market->setCost($_arrayMarket['cost']);
     $market->rating = $_arrayMarket['rating'];
     $market->setBuyer($_arrayMarket['buyer']);
     $market->setUpdateBy($_arrayMarket['updateBy']);
     $market->setPrivate($_arrayMarket['private']);
     $market->img = json_encode($_arrayMarket['img'], JSON_UNESCAPED_UNICODE);
     $market->link = json_encode($_arrayMarket['link'], JSON_UNESCAPED_UNICODE);
     $market->language = json_encode($_arrayMarket['language'], JSON_UNESCAPED_UNICODE);
     if (isset($_arrayMarket['hardwareCompatibility'])) {
         $market->hardwareCompatibility = json_encode($_arrayMarket['hardwareCompatibility'], JSON_UNESCAPED_UNICODE);
     }
     $market->change = '';
     $market->setRealcost($_arrayMarket['realCost']);
     if (!isset($_arrayMarket['isAuthor'])) {
         $_arrayMarket['isAuthor'] = true;
     }
     $market->setIsAuthor($_arrayMarket['isAuthor']);
     return $market;
 }
Example #5
0
 /**
  * return all tickets of a specific user.
  * an array of all tickets created by a specific user are returned by this function.
  * @param $author the id of the user of whom we want all tickets from.
  * @return an array containing all ticket objects related to a user.
  */
 public static function getTicketsOf($author)
 {
     $dbl = new DBLayer("lib");
     $statement = $dbl->execute("SELECT * FROM ticket INNER JOIN ticket_user ON ticket.Author = ticket_user.TUserId and ticket_user.ExternId=:id", array('id' => $author));
     $row = $statement->fetchAll();
     $result = array();
     foreach ($row as $ticket) {
         $instance = new self();
         $instance->setTId($ticket['TId']);
         $instance->setTimestamp($ticket['Timestamp']);
         $instance->setTitle($ticket['Title']);
         $instance->setStatus($ticket['Status']);
         $instance->setQueue($ticket['Queue']);
         $instance->setTicket_Category($ticket['Ticket_Category']);
         $instance->setAuthor($ticket['Author']);
         $result[] = $instance;
     }
     return $result;
 }
Example #6
0
File: Post.php Project: symbb/symbb
 public static function createNew(Topic $topic, \Symbb\Core\UserBundle\Entity\UserInterface $user)
 {
     $post = new self();
     $post->setTopic($topic);
     $post->setAuthor($user);
     $post->setName($topic->getName());
     return $post;
 }
Example #7
0
 /**
  * @param PostId $postId
  * @param string $author
  * @param string $content
  * @return Comment
  */
 public static function create(PostId $postId, $author, $content)
 {
     $comment = new self($commentId = CommentId::generate());
     $comment->setPostId($postId);
     $comment->setAuthor($author);
     $comment->setContent($content);
     $comment->setCreatingDate($creatingDate = new \DateTime());
     $comment->recordThat(new CommentWasAdded($commentId, $postId, $author, $content, $creatingDate));
     return $comment;
 }