Esempio n. 1
0
 /**
  * Returns some data used to create a star link.
  *
  * @param Item_Model $item  the related item
  * @return array
  */
 private static function _get_star_link_data(Item_Model $item)
 {
     if (star::is_starred($item)) {
         $action = "unstar";
         $action_label = "Unstar";
     } else {
         $action = "star";
         $action_label = "Star";
     }
     switch ($item->type) {
         case "movie":
             $item_type_label = "movie";
             break;
         case "album":
             $item_type_label = "album";
             break;
         default:
             $item_type_label = "photo";
             break;
     }
     $label = t("{$action_label} this {$item_type_label}");
     return array("text" => $label, "action" => $action);
 }
        ?>
"
  class="g-button ui-icon-left ui-state-default ui-corner-all"><?php 
        echo t("Star Image");
        ?>
</a>
</div>
<?php 
    }
}
?>

<?php 
if (false) {
    //old style. Notifications worked, but gave you a download popup and required manual refresh to see change.
    if (!star::is_starred($theme->item)) {
        $csrf = access::csrf_token();
        ?>
<div class="g-star-block">
<a href="<?php 
        echo url::site("display/star/{$theme->item->id}?csrf={$csrf}");
        ?>
"
   ajax_handler="function(data) { window.location.reload() }"
   title="<?php 
        echo t("Star options");
        ?>
"
  class="g-button ui-icon-left ui-state-default ui-corner-all"><?php 
        echo t("Star Image");
        ?>