/**
  * Import relevant properties from given test
  *
  * @param ilObjTest $a_test
  * @return object
  */
 public static function createFromTest(ilObjTest $a_test, $a_user_id)
 {
     global $lng;
     $lng->loadLanguageModule("wsp");
     $newObj = new self();
     $newObj->setTitle($lng->txt("wsp_type_tstv") . " \"" . $a_test->getTitle() . "\"");
     $newObj->setDescription($a_test->getDescription());
     $active_id = $a_test->getActiveIdOfUser($a_user_id);
     $pass = ilObjTest::_getResultPass($active_id);
     $date = $a_test->getPassFinishDate($active_id, $pass);
     $newObj->setProperty("issued_on", new ilDate($date, IL_CAL_UNIX));
     // create certificate
     include_once "Services/Certificate/classes/class.ilCertificate.php";
     include_once "Modules/Test/classes/class.ilTestCertificateAdapter.php";
     $certificate = new ilCertificate(new ilTestCertificateAdapter($a_test));
     $certificate = $certificate->outCertificate(array("active_id" => $active_id, "pass" => $pass), false);
     // save pdf file
     if ($certificate) {
         // we need the object id for storing the certificate file
         $newObj->create();
         $path = self::initStorage($newObj->getId(), "certificate");
         $file_name = "tst_" . $a_test->getId() . "_" . $a_user_id . "_" . $active_id . ".pdf";
         if (file_put_contents($path . $file_name, $certificate)) {
             $newObj->setProperty("file", $file_name);
             $newObj->update();
             return $newObj;
         }
         // file creation failed, so remove to object, too
         $newObj->delete();
     }
 }
Example #2
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement $xmlElement)
  * @return self
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     if (empty($xmlElement->title)) {
         throw new CultureFeed_Cdb_ParseException("Title missing for actordetail element");
     }
     $attributes = $xmlElement->attributes();
     if (empty($attributes['lang'])) {
         throw new CultureFeed_Cdb_ParseException("Lang missing for actordetail element");
     }
     $actorDetail = new self();
     $actorDetail->setTitle((string) $xmlElement->title);
     $actorDetail->setLanguage((string) $attributes['lang']);
     if (!empty($xmlElement->calendarsummary)) {
         $actorDetail->setCalendarSummary((string) $xmlElement->calendarsummary);
     }
     if (!empty($xmlElement->shortdescription)) {
         $actorDetail->setShortDescription((string) $xmlElement->shortdescription);
     }
     if (!empty($xmlElement->longdescription)) {
         $actorDetail->setLongDescription((string) $xmlElement->longdescription);
     }
     if (!empty($xmlElement->media->file)) {
         foreach ($xmlElement->media->file as $fileElement) {
             $actorDetail->media->add(CultureFeed_Cdb_Data_File::parseFromCdbXML($fileElement));
         }
     }
     return $actorDetail;
 }
 /**
  * Import relevant properties from given exercise
  *
  * @param ilObjExercise $a_test
  * @return object
  */
 public static function createFromExercise(ilObjExercise $a_exercise, $a_user_id)
 {
     global $lng;
     $lng->loadLanguageModule("exercise");
     $newObj = new self();
     $newObj->setTitle($a_exercise->getTitle());
     $newObj->setDescription($a_exercise->getDescription());
     include_once "Services/Tracking/classes/class.ilLPMarks.php";
     $lp_marks = new ilLPMarks($a_exercise->getId(), $a_user_id);
     $newObj->setProperty("issued_on", new ilDate($lp_marks->getStatusChanged(), IL_CAL_DATETIME));
     // create certificate
     include_once "Services/Certificate/classes/class.ilCertificate.php";
     include_once "Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
     $certificate = new ilCertificate(new ilExerciseCertificateAdapter($a_exercise));
     $certificate = $certificate->outCertificate(array("user_id" => $a_user_id), false);
     // save pdf file
     if ($certificate) {
         // we need the object id for storing the certificate file
         $newObj->create();
         $path = self::initStorage($newObj->getId(), "certificate");
         $file_name = "exc_" . $a_exercise->getId() . "_" . $a_user_id . ".pdf";
         if (file_put_contents($path . $file_name, $certificate)) {
             $newObj->setProperty("file", $file_name);
             $newObj->update();
             return $newObj;
         }
         // file creation failed, so remove to object, too
         $newObj->delete();
     }
     // remove if certificate works
     $newObj->create();
     return $newObj;
 }
 public static function withAttributes($title, $value, $isShort = true)
 {
     $instance = new self();
     $instance->setTitle($title);
     $instance->setValue($value);
     $instance->setShort($isShort);
     return $instance;
 }
Example #5
0
 /**
  * Message box
  *
  * @param   Window  $parent
  * @param   string  $text
  * @param   string  $title
  * @return void
  */
 public static function box(Window $parent, $text, $title)
 {
     $msg = new self($parent);
     $msg->setText($text);
     $msg->setTitle($title);
     $msg->start();
     unset($msg);
 }
Example #6
0
 public static function factory($label, $link, array $params = array('icon' => 'tool-blue'))
 {
     $button = new self();
     $button->setTitle($label);
     $button->setLink($link);
     $button->setDecoratorParams($params);
     return $button;
 }
Example #7
0
 /**
  * Create a window
  */
 public static function create($title, $width, $height)
 {
     $inst = new self();
     $inst->setIsWrapped(TRUE);
     $inst->setTitle($title);
     $inst->setSize($width, $height);
     unset($inst->wrapper->{'widget'});
     return $inst;
 }
Example #8
0
 /**
  * Add navigation node as a child
  * @staticvar int $counter
  * @param string $label
  * @param string $url
  * @param string $title
  * @return Node
  */
 public function addNode($label, $url, $title = NULL)
 {
     $node = new self();
     $node->setLabel($label);
     $node->setUrl($url);
     $node->setTitle($title);
     static $counter;
     $this->addComponent($node, ++$counter);
     return $node;
 }
Example #9
0
 /**
  * @param string      $title
  * @param string      $urn
  * @param string|null $theme
  * @param string|null $layout
  *
  * @return Node
  */
 public static function createPage($title, $urn, $theme = null, $layout = null)
 {
     $page = new self();
     $page->setType(self::TYPE_PAGE);
     $page->setTitle($title);
     $page->setUrn($urn);
     $page->setTheme($theme);
     $page->setLayout($layout);
     return $page;
 }
Example #10
0
 /**
  * @param $isbn10
  * @param $isbn13
  * @param $title
  * @param $authors
  * @param $publisher
  * @param $description
  * @param $pageCount
  * @param $imageLink
  *
  * @return Book
  */
 public static function buildComplete($isbn10, $isbn13, $title, $authors, $publisher, $description, $pageCount, $imageLink)
 {
     $instance = new self();
     $instance->setIsbn10($isbn10);
     $instance->setIsbn13($isbn13);
     $instance->setTitle($title);
     $instance->setAuthors($authors);
     $instance->setPublisher($publisher);
     $instance->setDescription($description);
     $instance->setPageCount($pageCount);
     $instance->setImageLink($imageLink);
     return $instance;
 }
 /**
  * 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 #12
0
 /**
  * @param Campaign $campaign
  * @param array $array
  * @return Campaign|Content
  */
 public static function createFromArray(Campaign $campaign = null, array $array = array())
 {
     $defaults = array("view_count" => 0, "like_count" => 0, "dislike_count" => 0, "favorite_count" => 0, "comment_count" => 0, "tw_share_count" => 0, "fb_share_count" => 0);
     $array = array_merge($defaults, $array);
     $content = new self($array['id'], $campaign);
     $content->setSource($array['source']);
     $content->setFoundAt(new \DateTime($array['found_at']));
     $content->setNativeId($array['native_id']);
     $content->setCreatedAt(new \DateTime($array['created_at']));
     $content->setUrl($array['url']);
     $content->setThumb($array['thumb']);
     $content->setVideoSrc($array['video_src']);
     $content->setTitle($array['title']);
     $content->setDescription($array['description']);
     $content->setVideoLength($array['video_length']);
     $content->setUsername($array['username']);
     $content->setViewCount($array['view_count']);
     $content->setLikeCount($array['like_count']);
     $content->setDislikeCount($array['dislike_count']);
     $content->setFavCount($array['favorite_count']);
     $content->setCommentCount($array['comment_count']);
     $content->setTwCount($array['tw_share_count']);
     $content->setFbCount($array['fb_share_count']);
     $content->setProcessed($array['processed']);
     if ($array['processed']) {
         $content->setProcessedAt(new \DateTime($array['processed_at']));
     }
     $content->setKeyword($array['keyword']);
     $content->setUserNativeId($array['user_native_id']);
     if (isset($array['popularity'])) {
         $content->setPopularity($array['popularity']);
     }
     if (isset($array['sr_status'])) {
         $content->setSrStatus($array['sr_status']);
     } else {
         if (isset($array['srstatus'])) {
             $content->setSrStatus($array['srstatus']);
         }
     }
     if (isset($array['followers'])) {
         $content->setUserReach($array['followers']);
     }
     return $content;
 }
Example #13
0
 /**
  * @param array $arr
  * @return RiakBlogPost|null
  */
 public static function instanceFromAssocArray($arr)
 {
     if ($arr !== null) {
         $instance = new self();
         $instance->identifier = $arr[static::$IDENTIFIER_NAME];
         $instance->setAuthorIdentifier($arr[static::$AUTHOR_ID_NAME]);
         $instance->setAuthorDisplayName($arr[static::$AUTHOR_DISP_NAME]);
         $instance->postedDate = Carbon::createFromFormat(\DateTime::ISO8601, $arr[static::$POST_DATE_NAME]);
         $instance->lastModifiedDate = Carbon::createFromFormat(\DateTime::ISO8601, $arr[static::$MODIFIED_DATE_NAME]);
         $instance->setTitle(isset($arr[static::$TITLE_NAME]) ? $arr[static::$TITLE_NAME] : "");
         $instance->setContent($arr[static::$CONTENT_NAME]);
         if ($arr[static::$PUBLISHED_NAME] == '1') {
             $instance->setIsPublished(true);
         } else {
             $instance->setIsPublished(false);
         }
         return $instance;
     }
 }
 /**
  * Import relevant properties from given learning module
  *
  * @param ilObjSAHSLearningModule $a_lm
  * @return object
  */
 public static function createFromSCORMLM(ilObjSAHSLearningModule $a_lm, $a_user_id)
 {
     global $lng;
     $lng->loadLanguageModule("sahs");
     $newObj = new self();
     $newObj->setTitle($a_lm->getTitle());
     $newObj->setDescription($a_lm->getDescription());
     include_once "Services/Tracking/classes/class.ilLPMarks.php";
     $lp_marks = new ilLPMarks($a_lm->getId(), $a_user_id);
     $newObj->setProperty("issued_on", new ilDate($lp_marks->getStatusChanged(), IL_CAL_DATETIME));
     // create certificate
     if (!stristr(get_class($a_lm), "2004")) {
         $last_access = ilObjSCORMLearningModule::_lookupLastAccess($a_lm->getId(), $a_user_id);
     } else {
         $last_access = ilObjSCORM2004LearningModule::_lookupLastAccess($a_lm->getId(), $a_user_id);
     }
     $params = array("user_data" => ilObjUser::_lookupFields($a_user_id), "last_access" => $last_access);
     include_once "Services/Certificate/classes/class.ilCertificate.php";
     include_once "Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
     $certificate = new ilCertificate(new ilSCORMCertificateAdapter($a_lm));
     $certificate = $certificate->outCertificate($params, false);
     // save pdf file
     if ($certificate) {
         // we need the object id for storing the certificate file
         $newObj->create();
         $path = self::initStorage($newObj->getId(), "certificate");
         $file_name = "sahs_" . $a_lm->getId() . "_" . $a_user_id . ".pdf";
         if (file_put_contents($path . $file_name, $certificate)) {
             $newObj->setProperty("file", $file_name);
             $newObj->update();
             return $newObj;
         }
         // file creation failed, so remove to object, too
         $newObj->delete();
     }
 }
Example #15
0
 /**
  * Create a new extraneous context. The context is filled with information
  * external to the current session.
  * - Title is specified by argument
  * - Request is a FauxRequest, or a FauxRequest can be specified by argument
  * - User is an anonymous user, for separation IPv4 localhost is used
  * - Language will be based on the anonymous user and request, may be content
  *   language or a uselang param in the fauxrequest data may change the lang
  * - Skin will be based on the anonymous user, should be the wiki's default skin
  *
  * @param Title $title Title to use for the extraneous request
  * @param WebRequest|array $request A WebRequest or data to use for a FauxRequest
  * @return RequestContext
  */
 public static function newExtraneousContext(Title $title, $request = [])
 {
     $context = new self();
     $context->setTitle($title);
     if ($request instanceof WebRequest) {
         $context->setRequest($request);
     } else {
         $context->setRequest(new FauxRequest($request));
     }
     $context->user = User::newFromName('127.0.0.1', false);
     return $context;
 }
Example #16
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;
 }
 public function doClone($a_pool_id)
 {
     $new_obj = new self();
     $new_obj->setPoolId($a_pool_id);
     $new_obj->setTitle($this->getTitle());
     $new_obj->setRaster($this->getRaster());
     $new_obj->setMinRental($this->getMinRental());
     $new_obj->setMaxRental($this->getMaxRental());
     $new_obj->setAutoBreak($this->getAutoBreak());
     $new_obj->setDeadline($this->getDeadline());
     $new_obj->setDefinition($this->getDefinition());
     return $new_obj->save();
 }
 public static function fromArray(\Doctrine\ORM\EntityManager $em, array $def, NavigationNode $parent = null)
 {
     $list = array();
     foreach ($def as $nodeDef) {
         $title = $nodeDef[0];
         $link = isset($nodeDef[1]) ? $nodeDef[1] : '';
         $tooltip = isset($nodeDef[2]) ? $nodeDef[2] : '';
         $children = isset($nodeDef[3]) ? $nodeDef[3] : null;
         $userGroups = isset($nodeDef[4]) ? $nodeDef[4] : null;
         $node = new self();
         $node->setTitle($title);
         $node->setLink($link);
         $node->setTooltip($tooltip);
         $em->persist($node);
         if ($parent !== null) {
             $node->setParent($parent);
         }
         if (is_array($children)) {
             $list = array_merge($list, self::fromArray($em, $children, $node));
         }
         if (is_array($userGroups)) {
             $node->setVisibleFor($userGroups);
         }
         $em->flush();
         $list[] = $node;
     }
     return $list;
 }
 /**
  * @param \SimpleXMLElement $product
  * @return ErpProductEntity
  */
 public static function createFromCatalogXmlResponse(\SimpleXMLElement $product)
 {
     $self = new self();
     $sku = isset($product->attributes()->ItemNo) ? (string) $product->attributes()->ItemNo : null;
     if (!$sku) {
         throw new \InvalidArgumentException('Invalid product downloaded from catalog');
     }
     $self->setSku($sku);
     $self->setTitle((string) $product->Description);
     $self->setLastUpdated(new \DateTime((string) $product->attributes()->LastUpdated));
     $self->setDescription((string) $product->Description);
     foreach ($product->SupplementalData as $data) {
         foreach ($data->attributes() as $k => $v) {
             switch ((string) $v) {
                 case 'webcategory':
                     $self->setCategory((string) $data);
                     break;
             }
         }
     }
     $self->setPrice((string) $product->Pricing->UnitPrice);
     $self->setQty((int) (string) $product->Availability->QtyAvailable);
     return $self;
 }
Example #20
0
 protected static function fromStdClass($obj)
 {
     $ret = new self($obj->eventid);
     $ret->setTitle($obj->title);
     $ret->setDescripion($obj->desc);
     $ret->setFrom(\DateTime::createFromFormat('Y-m-d H:i:s', $obj->from, new \DateTimeZone("UTC")));
     $ret->setTo(\DateTime::createFromFormat('Y-m-d H:i:s', $obj->to, new \DateTimeZone("UTC")));
     $ret->getFrom()->setTimezone(new \DateTimeZone(get_option('timezone_string')));
     $ret->getTo()->setTimezone(new \DateTimeZone(get_option('timezone_string')));
     $ret->setPlace(Place::findById($obj->placeid));
     $ret->setPostId($obj->postid);
     return $ret;
 }
 public static function factory($constructedChartData, $loadFromDB = true)
 {
     $chartObj = new self();
     if (isset($constructedChartData['chart_id'])) {
         $chartObj->setId((int) $constructedChartData['chart_id']);
         if ($loadFromDB) {
             $chartObj->loadFromDB();
             $chartObj->prepareData();
             $chartObj->shiftStringColumnUp();
         }
     }
     // Main data (steps 1-3 of chart constructor)
     $chartObj->setwpDataTableId($constructedChartData['wpdatatable_id']);
     $chartObj->setTitle($constructedChartData['chart_title']);
     $chartObj->setEngine($constructedChartData['chart_engine']);
     $chartObj->setType($constructedChartData['chart_type']);
     $chartObj->setSelectedColumns($constructedChartData['selected_columns']);
     $chartObj->setRangeType($constructedChartData['range_type']);
     if (isset($constructedChartData['range_data'])) {
         $chartObj->setRowRange($constructedChartData['range_data']);
     }
     $chartObj->setFollowFiltering((bool) $constructedChartData['follow_filtering']);
     // Render data (step 4 or chart constructor)
     $chartObj->setShowTitle(WDTTools::defineDefaultValue($constructedChartData, 'show_title', ''));
     $chartObj->setWidth(WDTTools::defineDefaultValue($constructedChartData, 'width', 400));
     $chartObj->setHeight(WDTTools::defineDefaultValue($constructedChartData, 'height', 400));
     $chartObj->setShowGrid(WDTTools::defineDefaultValue($constructedChartData, 'show_grid', true));
     $chartObj->setShowLegend(WDTTools::defineDefaultValue($constructedChartData, 'show_legend', true));
     $chartObj->setMajorAxisLabel(WDTTools::defineDefaultValue($constructedChartData, 'horizontal_axis_label', ''));
     $chartObj->setMinorAxisLabel(WDTTools::defineDefaultValue($constructedChartData, 'vertical_axis_label', ''));
     if (!empty($constructedChartData['series_data'])) {
         $chartObj->setUserDefinedSeriesData($constructedChartData['series_data']);
     }
     $chartObj->loadChildWPDataTable();
     return $chartObj;
 }
 public function doClone($a_pool_id, $a_schedule_map = null)
 {
     $new_obj = new self();
     $new_obj->setPoolId($a_pool_id);
     $new_obj->setTitle($this->getTitle());
     $new_obj->setDescription($this->getDescription());
     $new_obj->setNrOfItems($this->getNrOfItems());
     $new_obj->setFile($this->getFile());
     $new_obj->setPostText($this->getPostText());
     $new_obj->setPostFile($this->getPostFile());
     if ($a_schedule_map) {
         $schedule_id = $this->getScheduleId();
         if ($schedule_id) {
             $new_obj->setScheduleId($a_schedule_map[$schedule_id]);
         }
     }
     $new_obj->save();
     // files
     $source = $this->initStorage($this->getId());
     $target = $new_obj->initStorage($new_obj->getId());
     ilUtil::rCopy($source, $target);
 }
Example #23
0
 /**
  * @param string $title
  * @param string $content
  * @return Post
  */
 public static function create($title, $content)
 {
     $post = new self($postId = PostId::generate());
     $post->setTitle($title);
     $post->setContent($content);
     $post->setPublishingDate($publishingDate = new \DateTime());
     $post->recordThat(new PostWasPublished($postId, $title, $content, $publishingDate));
     return $post;
 }
Example #24
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement $xmlElement)
  * @return CultureFeed_Cdb_List_Item
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     $attributes = $xmlElement->attributes();
     $item = new self();
     // Set ID.
     $item->setCdbId((string) $attributes['cidn']);
     if (!empty($attributes['private'])) {
         $item->setPrivate((bool) $attributes['private']);
     }
     if (!empty($attributes['externalid'])) {
         $item->setExternalId((string) $attributes['externalid']);
     }
     $item->setTitle((string) $attributes['title']);
     if (!empty($attributes['shortdescription'])) {
         $item->setShortDescription((string) $attributes['shortdescription']);
     }
     if (!empty($attributes['thumbnail'])) {
         $item->setThumbnail((string) $attributes['thumbnail']);
     }
     if (!empty($attributes['address'])) {
         $item->setAddress((string) $attributes['address']);
     }
     if (!empty($attributes['city'])) {
         $item->setCity((string) $attributes['city']);
     }
     if (!empty($attributes['zip'])) {
         $item->setZip((string) $attributes['zip']);
     }
     if (!empty($attributes['latlng'])) {
         $item->setCoordinates((string) $attributes['latlng']);
     }
     if (!empty($attributes['location'])) {
         $item->setLocation((string) $attributes['location']);
     }
     if (!empty($attributes['locationid'])) {
         $item->setLocationId((string) $attributes['locationid']);
     }
     if (!empty($attributes['calendarsummary'])) {
         $item->setCalendarSummary((string) $attributes['calendarsummary']);
     }
     if (!empty($attributes['itemtype'])) {
         $item->setType((string) $attributes['itemtype']);
     }
     if (!empty($attributes['price'])) {
         $item->setPrice((string) $attributes['price']);
     }
     if (!empty($attributes['pricedescription'])) {
         $item->setPriceDescription((string) $attributes['pricedescription']);
     }
     if (!empty($attributes['agefrom'])) {
         $item->setAgeFrom((string) $attributes['agefrom']);
     }
     if (!empty($attributes['performers'])) {
         $item->setPerformers((string) $attributes['performers']);
     }
     return $item;
 }
Example #25
0
 public static function createTeacherFromId($id)
 {
     $teacher = new self();
     $query = "SELECT * FROM TUSERS U JOIN TSTAFF S ON U.`User ID` = S.`User ID` WHERE U.`User ID` = {$id}";
     $user = db_select($query);
     $teacher->setUserId($id);
     $teacher->setFirstName($user[0]['First Name']);
     $teacher->setSurname($user[0]['Surname']);
     $teacher->setTitle($user[0]['Title']);
     $teacher->setStaffId($user[0]['Staff ID']);
     $teacher->setEmail($user[0]['Email']);
     $teacher->setClassroom($user[0]['Classroom']);
     $teacher->setPhoneNumber($user[0]['Phone Number']);
     $teacher->setRole($user[0]['Role']);
     $teacher->setInitials($user[0]['Initials']);
     $teacher->setValidation($user[0]['Validation']);
     return $teacher;
 }
Example #26
0
 public static function fromArray($array)
 {
     $model = new self();
     if (isset($array['title'])) {
         $model->setTitle($array['title']);
     }
     if (isset($array['numbers'])) {
         $model->setNumbers($array['numbers']);
     }
     return $model;
 }
 /**
  * @param $index
  * @param $title
  * @param $image
  * @param string $type
  * @param string $submitTitle
  * @param string $submitClass
  *
  * @return Panel
  *
  * @author Panagiotis Vagenas <*****@*****.**>
  * @since ${VERSION}
  */
 public function factory($index, $title, $image, $type = 'main', $submitTitle = 'Save', $submitClass = 'button pull-right')
 {
     $panel = new self($this->moduleInstance);
     $panel->setTab($index);
     $panel->setTitle($title);
     $this->title = $title;
     if ($image) {
         $panel->setImage($image);
     }
     $panel->setSubmit(array('title' => $submitTitle, 'class' => $submitClass));
     $panel->setType($type);
     return $panel;
 }
Example #28
0
 public static function createInstance($ou_title, $ou_subtitle, $ou_import_id)
 {
     $unit = new self();
     $unit->setTitle($ou_title)->setSubTitle($ou_subtitle)->setImportId($ou_import_id)->create();
     self::$instance_cache[$unit->getId()] = $unit;
     return $unit;
 }
Example #29
0
 public static function show($type, $title = null)
 {
     $icon = new self($type);
     if ($title) {
         $icon->setTitle($title);
     }
     return $icon->__toString();
 }