Example #1
0
 public static function send()
 {
     $me = new self("global");
     $sent = array();
     $pastlink = new FutureLink_PastUI();
     $feed = $pastlink->feed();
     $items = array();
     //we send something only if we have something to send
     if (empty($feed->feed->entry) == false) {
         foreach ($feed->feed->entry as &$item) {
             if (empty($item->futurelink->href) || isset($sent[$item->futurelink->hash])) {
                 continue;
             }
             $sent[$item->futurelink->hash] = true;
             $client = new Zend\Http\Client($item->futurelink->href, array('timeout' => 60));
             if (!empty($feed->feed->entry)) {
                 $client->setParameterPost(array('protocol' => 'futurelink', 'metadata' => json_encode($feed)));
                 try {
                     $client->setMethod(Zend\Http\Request::METHOD_POST);
                     $response = $client->send();
                     $request = $client->getLastResponse();
                     $result = $response->getBody();
                     $resultJson = json_decode($response->getBody());
                     //Here we add the date last updated so that we don't have to send it if not needed, saving load time.
                     if (!empty($resultJson->feed) && $resultJson->feed == "success") {
                         $me->addItem(array('dateLastUpdated' => $item->pastlink->dateLastUpdated, 'pastlinklinkHash' => $item->pastlink->hash, 'futurelinkHash' => $item->futurelink->hash));
                     }
                     $items[$item->pastlink->text] = $result;
                 } catch (Exception $e) {
                 }
             }
         }
         return $items;
     }
 }
Example #2
0
 public static function getFromId($id)
 {
     $db = Neuron_DB_Database::getInstance();
     $id = intval($id);
     $d = $db->query("\n\t\t\tSELECT\n\t\t\t\t*,\n\t\t\t\tUNIX_TIMESTAMP(er_date) AS datum\n\t\t\tFROM\n\t\t\t\teffect_report\n\t\t\tWHERE\n\t\t\t\ter_id = {$id}\n\t\t");
     if (count($d) > 0) {
         $village = Dolumar_Registry_Village::getInstance()->get($d[0]['er_vid']);
         $classname = 'Dolumar_Report_' . $d[0]['er_type'];
         if (class_exists($classname)) {
             $report = new $classname($village);
         } else {
             $report = new self($village);
         }
         $report->setId($id);
         foreach (self::getObjectsFromLog($d[0]['er_data']) as $v) {
             $report->addItem($v);
         }
         $report->setDate($d[0]['datum']);
         if (isset($d[0]['er_target_v_id'])) {
             $report->setTarget(Dolumar_Registry_Village::getInstance()->get($d[0]['er_target_v_id']));
         }
         return $report;
     }
     return false;
 }
Example #3
0
 public static function collection(array $items = array())
 {
     $collection = new self(TOGoS_XMLRDFParser_RDF_Namespaces::RDF_COLLECTION);
     foreach ($items as $item) {
         $collection->addItem($item);
     }
     return $collection;
 }
Example #4
0
 /**
  * This is just for compatibility, this method will be removed with the next major release
  * @depricated
  * @static
  * @param $config
  * @return self
  */
 public static function getByLegacyConfig($config)
 {
     $pipe = new self();
     if (isset($config["format"])) {
         $pipe->setFormat($config["format"]);
     }
     if (isset($config["quality"])) {
         $pipe->setQuality($config["quality"]);
     }
     if (isset($config["cover"])) {
         $pipe->addItem("cover", ["width" => $config["width"], "height" => $config["height"], "positioning" => "center"]);
     } elseif (isset($config["contain"])) {
         $pipe->addItem("contain", ["width" => $config["width"], "height" => $config["height"]]);
     } elseif (isset($config["frame"])) {
         $pipe->addItem("frame", ["width" => $config["width"], "height" => $config["height"]]);
     } elseif (isset($config["aspectratio"]) && $config["aspectratio"]) {
         if (isset($config["height"]) && isset($config["width"]) && $config["height"] > 0 && $config["width"] > 0) {
             $pipe->addItem("contain", ["width" => $config["width"], "height" => $config["height"]]);
         } elseif (isset($config["height"]) && $config["height"] > 0) {
             $pipe->addItem("scaleByHeight", ["height" => $config["height"]]);
         } else {
             $pipe->addItem("scaleByWidth", ["width" => $config["width"]]);
         }
     } else {
         if (!isset($config["width"]) && isset($config["height"])) {
             $pipe->addItem("scaleByHeight", ["height" => $config["height"]]);
         } elseif (isset($config["width"]) && !isset($config["height"])) {
             $pipe->addItem("scaleByWidth", ["width" => $config["width"]]);
         } elseif (isset($config["width"]) && isset($config["height"])) {
             $pipe->addItem("resize", ["width" => $config["width"], "height" => $config["height"]]);
         }
     }
     if (isset($config["highResolution"])) {
         $pipe->setHighResolution($config["highResolution"]);
     }
     $hash = md5(Serialize::serialize($pipe));
     $pipe->setName("auto_" . $hash);
     return $pipe;
 }
 /**
  * @param string $label
  * @param string $status
  * @param string $comment
  * @return DiagnosticResult
  */
 public static function singleResult($label, $status, $comment = '')
 {
     $result = new self($label);
     $result->addItem(new DiagnosticResultItem($status, $comment));
     return $result;
 }
 /**
  * {@inheritdoc}
  */
 public static function fromArray(array $values)
 {
     $message = new self();
     $values = array_merge(['item' => []], $values);
     foreach ($values['item'] as $item) {
         $message->addItem($item);
     }
     return $message;
 }
Example #7
0
 private static function create(FingerPrint $fingerPrint, $id, DateTime $date, $email, $totalItems, $totalOrder, $quantityInstallments, $ip, $origin, CustomerBillingData $customerBillingData, CustomerShippingData $shippingData, Payment $payment, Item $item, Passenger $passenger = null, Connection $connection = null, HotelReservation $hotelReservation = null)
 {
     $instance = new self();
     $instance->setFingerPrint($fingerPrint);
     $instance->setId($id);
     $instance->setDate($date);
     $instance->setEmail($email);
     $instance->setTotalItems($totalItems);
     $instance->setTotalOrder($totalOrder);
     $instance->setQuantityInstallments($quantityInstallments);
     $instance->setIp($ip);
     $instance->setOrigin($origin);
     $instance->setBillingData($customerBillingData);
     $instance->setShippingData($shippingData);
     $instance->addPayment($payment);
     $instance->addItem($item);
     if (null !== $passenger) {
         $instance->addPassenger($passenger);
     }
     if (null !== $connection) {
         $instance->addConnection($connection);
     }
     if (null !== $hotelReservation) {
         $instance->addHotelReservation($hotelReservation);
     }
     return $instance;
 }