Ejemplo n.º 1
0
 /**
  * Get Icon URL
  * @param str $size
  * @return str
  */
 public function getIconURL($size = 'medium')
 {
     if ($this->icontime) {
         return elgg_get_config('url') . "framework/icon/{$this->guid}/{$size}/{$this->icontime}.jpg";
     }
     return parent::getIconURL($size);
 }
Ejemplo n.º 2
0
 /**
  * Returns icon url for the application
  * 
  * @param string $size icon size
  * 
  * @return string
  * 
  * @see ElggEntity::getIconURL()
  */
 function getIconURL($size = "medium")
 {
     if (isset($this->icon_url)) {
         return $this->icon_url;
     } else {
         return parent::getIconURL($size);
     }
 }
Ejemplo n.º 3
0
 public function testElggEntityGetIconURL()
 {
     elgg_register_plugin_hook_handler('entity:icon:url', 'object', function ($hook, $type, $url, $params) {
         $size = (string) elgg_extract('size', $params);
         return "{$size}.jpg";
     }, 99999);
     $obj = new \ElggObject();
     $obj->save();
     // Test default size
     $this->assertEqual($obj->getIconURL(), elgg_normalize_url('medium.jpg'));
     // Test size
     $this->assertEqual($obj->getIconURL('small'), elgg_normalize_url('small.jpg'));
     // Test mixed params
     $this->assertEqual($obj->getIconURL('small'), $obj->getIconURL(array('size' => 'small')));
     // Test bad param
     $this->assertEqual($obj->getIconURL(new \stdClass()), elgg_normalize_url('medium.jpg'));
 }
Ejemplo n.º 4
0
 /**
  * @SWG\Definition(
  *  definition="Event",
  *  required={"guid","title"},
  *  @SWG\Property(property="guid", type="integer"),
  *  @SWG\Property(property="title", type="string"),
  *  @SWG\Property(property="description", type="string"),
  *  @SWG\Property(property="start_time", type="string"),
  *  @SWG\Property(property="end_time", type="string"),
  *  @SWG\Property(property="url", type="string"),
  *  @SWG\Property(property="icon_url", type="string"),
  *  @SWG\Property(property="time_created", type="string")
  * )
  */
 private function parseEvent(\ElggObject $event)
 {
     $start_time = mktime(date("H", $event->start_time), date("i", $event->start_time), 0, date("n", $event->start_day), date("j", $event->start_day), date("Y", $event->start_day));
     if ($event->end_ts) {
         $end_time = date('c', $event->end_ts);
     } else {
         $end_time = null;
     }
     return array('guid' => $event->guid, 'title' => html_entity_decode($event->title, ENT_QUOTES), 'description' => html_entity_decode($event->description, ENT_QUOTES), 'start_time' => date('c', $start_time), 'end_time' => $end_time, 'url' => $event->getURL(), 'icon_url' => $event->getIconURL(), 'time_created' => date('c', $event->time_created));
 }