static function item_edit_form($item, $view) { $url = url::site("tags/autocomplete"); $view->script[] = "\$('#gEditFormContainer form').ready(function() {\n \$('#gEditFormContainer form input[id=tags]').autocomplete(\n '{$url}', {max: 30, formatResult: formatTagAutoCompleteResult}\n );\n });"; $tag_value = implode("; ", tag::item_tags($item)); $view->form->edit_item->input("tags")->label(t("Tags (comma or semicolon separated)"))->value($tag_value); }
function dialog($album_id) { $album = ORM::factory("item", $album_id); access::required("view", $album); if (!access::can("edit", $album)) { // The user can't edit; perhaps they just logged out? url::redirect($album->abs_url()); } $v = new Theme_View("page.html", "collection", "captionator"); $v->content = new View("captionator_dialog.html"); $v->content->album = $album; $v->content->enable_tags = module::is_active("tag"); if ($v->content->enable_tags) { $v->content->tags = array(); foreach ($album->viewable()->children() as $child) { $item = ORM::factory("item", $child->id); $tag_names = array(); foreach (tag::item_tags($item) as $tag) { $tag_names[] = $tag->name; } $v->content->tags[$child->id] = implode(", ", $tag_names); } } print $v; }
public function tags_for($id) { $item = ORM::factory("item", $id); access::required("view", $item); $view = new View("tag_it_tags_for.html"); $view->tags = tag::item_tags($item); print $view; }
static function get($request) { $item = rest::resolve($request->url); $tags = array(); foreach (tag::item_tags($item) as $tag) { $tags[] = rest::url("tag_item", $tag, $item); } return array("url" => $request->url, "members" => $tags); }
static function relationships($resource_type, $resource) { switch ($resource_type) { case "item": $tags = array(); foreach (tag::item_tags($resource) as $tag) { $tags[] = rest::url("tag_item", $tag, $resource); } return array("tags" => array("url" => rest::url("item_tags", $resource), "members" => $tags)); } }
static function get($block_id, $theme) { $block = new Block(); switch ($block_id) { case "simple": $item = $theme->item; if (!$item or !$item->is_photo()) { return ""; } $block->css_id = "g-about-this-photo"; $block->title = t("About this photo"); $block->content = new View("about_this_photo.html"); // exif API doesn't give easy access to individual keys, so do this the hard way if (module::is_active("exif")) { $exif = ORM::factory("exif_record")->where("item_id", "=", $theme->item()->id)->find(); if ($exif->loaded()) { $exif = unserialize($exif->data); $timestamp = strtotime($exif["DateTime"]); //$block->content->date = gallery::date($timestamp); $block->content->date = date('D j M Y', $timestamp); $block->content->time = gallery::time($timestamp); } } $block->content->vcount = $theme->item()->view_count; // IPTC - copied more or less from iptc.php if (module::is_active("iptc")) { $record = ORM::factory("iptc_record")->where("item_id", "=", $theme->item()->id)->find(); if ($record->loaded()) { $record = unserialize($record->data); $block->content->source = $record["Source"]; $block->content->caption = $record["Caption"]; } } if (module::is_active("tag")) { $block->content->tags = tag::item_tags($theme->item()); } break; } return $block; }
public function about($id) { $item = ORM::factory("item", $id); access::required("view", $item); $v = new Theme_View("about.html", "", ""); $v->item = $item; $details = array(array("caption" => "Title", "value" => $item->title)); if ($item->description != $item->title) { array_push($details, array("caption" => "Description", "value" => $item->description)); } if (isset($item->captured)) { array_push($details, array("caption" => "Captured", "value" => date(module::get_var("gallery", "date_time_format", "Y-M-d H:i:s"), $item->captured))); } array_push($details, array("caption" => "Owner", "value" => $item->owner_id)); array_push($details, array("caption" => "Filename", "value" => $item->name)); array_push($details, array("caption" => "View count", "value" => $item->view_count)); $v->details = $details; if (module::is_active("tag")) { $v->tags = tag::item_tags($item); } print $v; }
static function item_index_data($item, $data) { foreach (tag::item_tags($item) as $tag) { $data[] = $tag->name; } }
public function fancylink($item, $view_type = "album", $group_img = true, $display_comment = true, $parent_title_class = "h2") { // view_type = album || dynamic || header $link = ""; access::required("view", $item); $photo_size = module::get_var("three_nids", "photo_size"); if ($photo_size == "full" || $item->is_movie()) { $width = $item->width; $height = $item->height; } else { $width = $item->resize_width; $height = $item->resize_height; } $description_mode = module::get_var("three_nids", "description"); $description = ""; $tags = tag::item_tags($item); if (count($tags) && $description_mode == "tags") { $description = " || " . implode(", ", $tags); } else { if ($description_mode == "item" && $item->description != "") { $description = " || " . str_replace("\"", """, $item->description); } else { if (($description_mode == "parent" || $description_mode == "item") && $item->parent()->description != "") { $description = " || " . str_replace("\"", """, $item->parent()->description); } } } $title_mode = module::get_var("three_nids", "title"); if ($title_mode == "parent") { $title = html::clean($item->parent()->title); } else { $title = html::clean($item->title); } $rel = ""; if ($group_img == true) { $rel = " rel=\"fancygroup\" "; } if ($item->is_photo() || $item->is_movie()) { $fancymodule = ""; if (module::is_active("exif")) { $fancymodule .= "exif::" . url::site("exif/show/{$item->id}") . ";;"; } if (module::is_active("comment")) { $fancymodule .= "comment::" . url::site("three_nids/show_comments/{$item->id}") . ";;comment_count::" . three_nids::comment_count($item) . ";;"; } if ($item->is_photo()) { $link .= "<a href=\"" . url::site("photos/{$item->id}") . "/?w=" . $width . "xewx&h=" . $height . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $title . $description . "\" name=\"" . $fancymodule . " \">"; } else { $link .= "<a href=\"" . url::site("movies/{$item->id}") . "/?w=" . strval(20 + $width) . "xewx&h=" . strval(50 + $height) . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $item->parent()->title . $description . "\" name=\"" . $fancymodule . " \">"; } } else { if ($item->is_album() && $view_type != "header") { $link .= "<a href=\"" . $item->url() . "\">"; } else { // NOTE: we don't want to open an <a> here because $view_type is "header", but lower down // we're going to close one, so that's going to generate a mismatch. For now, just open a // link anyway. // @todo: figure out what we really should be doing here. $link .= "<a href=\"" . $item->url() . "\">"; } } if ($view_type != "header") { $link .= $item->thumb_img(array("class" => "g-thumbnail")) . "</a>"; if ($item->is_album() && $view_type == "album") { $link .= "<a href=\"" . $item->url() . "?show=" . $item->id . "\"><{$parent_title_class}><span></span>" . html::clean($item->title) . "</{$parent_title_class}></a>"; } else { if (!$item->is_album() && $view_type == "dynamic") { $link .= "<a href=\"" . $item->parent()->url() . "?show=" . $item->id . "\" class=\"g-parent-album\"><{$parent_title_class}><span></span>" . html::clean($item->parent()->title) . "</{$parent_title_class}></a>"; } } if (($item->is_photo() || $item->is_movie()) && $display_comment && module::is_active("comment")) { $link .= "<ul class=\"g-metadata\"><li><a href=\"" . url::site("three_nids/show_comments/{$item->id}") . "\" class=\"iframe fancyclass g-hidden\">" . three_nids::comment_count($item) . " " . t("comments") . "</a></li></ul>"; } } else { $link .= "</a>"; } return $link; }
static function info_block_get_metadata($block, $item) { $tags = array(); foreach (tag::item_tags($item) as $tag) { $tags[] = "<a href=\"{$tag->url()}\">" . html::clean($tag->name) . "</a>"; } if ($tags) { $info = $block->content->metadata; $info["tags"] = array("label" => t("Tags:"), "value" => implode(", ", $tags)); $block->content->metadata = $info; } }
static function item_index_data($item, $data) { $data[] = join(" ", tag::item_tags($item)); }
static function item_edit_form($item, $form) { $tag_value = implode("; ", tag::item_tags($item)); $form->edit_item->input("tags")->label(t("Tags (separate by , or ;)"))->value($tag_value); }
static function item_index_data($item) { return join(" ", tag::item_tags($item)); }
public function fancylink($item, $viewtype = "album", $groupImg = true, $displayComment = true, $parentTitleClass = "h2") { //viewtype = album || dynamic || header $link = ""; access::required("view", $item); $photo_size = module::get_var("theme_3nids", "photo_size"); if ($photo_size == "full") { $width = $item->width; $height = $item->height; } else { $width = $item->resize_width; $height = $item->resize_height; } $desriptionMode = module::get_var("theme_3nids", "description"); $description = ""; $tags = tag::item_tags($item); if (count($tags) && $desriptionMode == "tags") { $description = " || " . implode(", ", $tags); } elseif ($desriptionMode == "item" && $item->description != "") { $description = " || " . str_replace("\"", """, $item->description); } elseif (($desriptionMode == "parent" || $desriptionMode == "item") && $item->parent()->description != "") { $description = " || " . str_replace("\"", """, $item->parent()->description); } $titleMode = module::get_var("theme_3nids", "title"); if ($titleMode == "parent") { $title = html::clean($item->parent()->title); } else { $title = html::clean($item->title); } $rel = ""; if ($groupImg == true) { $rel = " rel=\"fancygroup\" "; } if ($item->is_photo() || $item->is_movie()) { $fancymodule = ""; if (module::is_active("exif")) { $fancymodule .= "exif::" . url::site("exif/show/{$item->id}") . ";;"; } if (module::is_active("comment")) { $fancymodule .= "comment::" . url::site("comments_3nids?item_id={$item->id}") . ";;comment_count::" . comment_3nids::count($item) . ";;"; } if ($item->is_photo()) { $link .= "<a href=\"" . url::site("photo_3nids/show/{$item->id}") . "/?w=" . $width . "xewx&h=" . $height . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $title . $description . "\" name=\"" . $fancymodule . " \">"; } else { $link .= "<a href=\"" . url::site("movie_3nids/show/{$item->id}") . "/?w=" . strval(20 + $width) . "xewx&h=" . strval(50 + $height) . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $item->parent()->title . $description . "\" name=\"" . $fancymodule . " \">"; } } elseif ($item->is_album() && $viewtype != "header") { $link .= "<a href=\"" . $item->url() . "\">"; } if ($viewtype != "header") { $link .= $item->thumb_img(array("class" => "g-thumbnail")) . "</a>"; if ($item->is_album() && $viewtype == "album") { $link .= "<a href=\"" . $item->url() . "?show=" . $item->id . "\"><{$parentTitleClass}><span></span>" . html::clean($item->title) . "</{$parentTitleClass}></a>"; } elseif (!$item->is_album() && $viewtype == "dynamic") { $link .= "<a href=\"" . $item->parent()->url() . "?show=" . $item->id . "\" class=\"g-parent-album\"><{$parentTitleClass}><span></span>" . html::clean($item->parent()->title) . "</{$parentTitleClass}></a>"; } if (($item->is_photo() || $item->is_movie()) && $displayComment == true && module::is_active("comment")) { $link .= "<ul class=\"g-metadata\"><li><a href=\"" . url::site("comments_3nids?item_id={$item->id}") . "\" class=\"iframe fancyclass g-hidden\">" . comment_3nids::count($item) . " " . t("comments") . "</a></li></ul>"; } } else { $link .= "</a>"; } return $link; }