public function getLabel()
 {
     // if the property is a date object converting it to a human readable representation.
     if ($this->literal instanceof EasyRdf_Literal_Date) {
         try {
             $val = $this->literal->getValue();
             return Punic\Calendar::formatDate($val, 'short');
         } catch (Exception $e) {
             trigger_error($e->getMessage(), E_USER_WARNING);
             return (string) $this->literal;
         }
     }
     return $this->literal->getValue();
 }
Example #2
0
File: l10n.php Project: slapia/core
 /**
  * @return int
  */
 public function getFirstWeekDay()
 {
     $locale = $this->getLanguageCode();
     $locale = $this->transformToCLDRLocale($locale);
     return Punic\Calendar::getFirstWeekday($locale);
 }
Example #3
0
 /**
  * @return int
  */
 public function getFirstWeekDay()
 {
     $locale = self::findLanguage();
     return Punic\Calendar::getFirstWeekday($locale);
 }
Example #4
0
 /**
  * Returns a list of recently changed or entirely new concepts.
  * @param string $clang content language for the labels 
  * @param string $lang UI language for the dates
  * @return Array 
  */
 public function getChangeList($prop, $clang, $lang, $offset)
 {
     $changelist = $this->getSparql()->queryChangeList($clang, $offset, $prop);
     $bydate = array();
     foreach ($changelist as $concept) {
         $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang);
         $bydate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept;
     }
     return $bydate;
 }
Example #5
0
 /**
  * Gets the creation date and modification date if available.
  * @return String containing the date information in a human readable format.
  */
 public function getDate()
 {
     $ret = '';
     $created = '';
     $modified = '';
     try {
         // finding the created properties
         if ($this->resource->get('dc11:created')) {
             $created = $this->resource->get('dc11:created')->getValue();
         } else {
             if ($this->resource->get('dc:created')) {
                 $created = $this->resource->get('dc:created')->getValue();
             }
         }
         // finding the modified properties
         if ($this->resource->get('dc11:modified')) {
             $modified = $this->resource->get('dc11:modified')->getValue();
         } else {
             if ($this->resource->get('dc:modified')) {
                 $modified = $this->resource->get('dc:modified')->getValue();
             }
         }
         // making a human readable string from the timestamps
         if ($created != '') {
             $ret = gettext('skosmos:created') . ' ' . Punic\Calendar::formatDate($created, 'short');
         }
         if ($modified != '') {
             if ($created != '') {
                 $ret .= ', ' . gettext('skosmos:modified') . ' ' . Punic\Calendar::formatDate($modified, 'short');
             } else {
                 $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . Punic\Calendar::formatDate($modified, 'short');
             }
         }
     } catch (Exception $e) {
         trigger_error($e->getMessage(), E_USER_WARNING);
         return gettext('skosmos:modified') . ' ' . (string) $this->resource->get('dc:modified') . ' ' . gettext('skosmos:created') . ' ' . (string) $this->resource->get('dc:created');
     }
     return $ret;
 }