echo '<div class="pg-cv-name pg-cv-folder">' . PhocaGalleryText::wordDelete($cv->title, $this->tmpl['char_cat_length_name'], '...') . '</div>'; } } // Image Name if ($cv->type == 2) { if ($cv->display_name == 1) { echo '<div class="pg-cv-name">' . PhocaGalleryText::wordDelete($cv->title, $this->tmpl['charlengthname'], '...') . '</div>'; } if ($cv->display_name == 2) { echo '<div class="pg-cv-name"> </div>'; } } // Rate Image if ($cv->item_type == 'image') { if ($this->tmpl['display_rating_img'] == 2) { echo PhocaGalleryRateImage::renderRateImg($cv->id, $this->tmpl['diff_thumb_height'], 1); } else { if ($this->tmpl['display_rating_img'] == 1) { echo '<div><a class="' . $cv->buttonother->methodname . '" title="' . JText::_('COM_PHOCAGALLERY_RATE_IMAGE') . '"' . ' href="' . JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $cv->catslug . '&id=' . $cv->slug . $this->tmpl['tmplcom'] . '&Itemid=' . $this->itemId) . '"'; echo PhocaGalleryRenderFront::renderAAttributeOther($this->tmpl['detail_window'], $cv->buttonother->optionsrating, $this->tmpl['highslideonclick'], $this->tmpl['highslideonclick2']); echo ' >'; echo '<div><ul class="star-rating-small">' . '<li class="current-rating" style="width:' . $cv->voteswidthimg . 'px"></li>' . '<li><span class="star1"></span></li>'; for ($iV = 2; $iV < 6; $iV++) { echo '<li><span class="stars' . $iV . '"></span></li>'; } echo '</ul></div>' . "\n"; echo '</a></div>' . "\n"; } } } if ($cv->display_icon_detail == 1 || $cv->display_icon_download > 0 || $cv->display_icon_vm || $cv->start_cooliris == 1 || $cv->trash == 1 || $cv->publish_unpublish == 1 || $cv->display_icon_geo == 1 || $cv->display_icon_commentimg == 1 || $cv->camera_info == 1 || $cv->display_icon_extlink1 == 1 || $cv->display_icon_extlink2 == 1 || $cv->camera_info == 1) {
function display($tpl = null) { if (!JRequest::checkToken('request')) { $response = array('status' => '0', 'error' => JText::_('JINVALID_TOKEN')); echo json_encode($response); return; } $app = JFactory::getApplication(); $params =& $app->getParams(); $ratingVote = $app->input->get('ratingVote', 0, 'int'); $ratingId = $app->input->get('ratingId', 0, 'int'); // ID of File $format = $app->input->get('format', '', 'string'); $task = $app->input->get('task', '', 'string'); $view = $app->input->get('view', '', 'string'); $small = $app->input->get('small', 1, 'string'); //small or large rating icons $paramsC = JComponentHelper::getParams('com_phocagallery'); $param['display_rating_img'] = $paramsC->get('display_rating_img', 0); // Check if rating is enabled - if not then user should not be able to rate or to see updated reating if ($task == 'refreshrate' && (int) $param['display_rating_img'] == 2) { $ratingOutput = PhocaGalleryRateImage::renderRateImg((int) $ratingId, $param['display_rating_img'], $small, true); // ID of $response = array('status' => '0', 'message' => $ratingOutput); echo json_encode($response); return; //return $ratingOutput; } else { if ($task == 'rate') { $user =& JFactory::getUser(); //$view = JRequest::getVar( 'view', '', 'get', '', JREQUEST_NOTRIM ); //$Itemid = JRequest::getVar( 'Itemid', 0, '', 'int'); $neededAccessLevels = PhocaGalleryAccess::getNeededAccessLevels(); $access = PhocaGalleryAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels); $post['imgid'] = (int) $ratingId; $post['userid'] = $user->id; $post['rating'] = (int) $ratingVote; if ($format != 'json') { $msg = JText::_('COM_PHOCAGALLERY_ERROR_WRONG_RATING'); $response = array('status' => '0', 'error' => $msg); echo json_encode($response); return; } if ((int) $post['imgid'] < 1) { $msg = JText::_('COM_PHOCAGALLERY_ERROR_IMAGE_NOT_EXISTS'); $response = array('status' => '0', 'error' => $msg); echo json_encode($response); return; } $model = $this->getModel(); $checkUserVote = PhocaGalleryRateImage::checkUserVote($post['imgid'], $post['userid']); // User has already rated this category if ($checkUserVote) { $msg = JText::_('COM_PHOCAGALLERY_ALREADY_RATE_IMG'); $response = array('status' => '0', 'error' => '', 'message' => $msg); echo json_encode($response); return; } else { if ((int) $post['rating'] < 1 || (int) $post['rating'] > 5) { $msg = JText::_('COM_PHOCAGALLERY_ERROR_WRONG_RATING'); $response = array('status' => '0', 'error' => $msg); echo json_encode($response); return; } if ($access > 0 && $user->id > 0) { if (!$model->rate($post)) { $msg = JText::_('COM_PHOCAGALLERY_ERROR_RATING_IMG'); $response = array('status' => '0', 'error' => $msg); echo json_encode($response); return; } else { $msg = JText::_('COM_PHOCAGALLERY_SUCCESS_RATING_IMAGE'); $msg = ''; // No changing of the box, no message, only change the rating $response = array('status' => '1', 'error' => '', 'message' => $msg); echo json_encode($response); return; } } else { $msg = JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION'); $response = array('status' => '0', 'error' => $msg); echo json_encode($response); return; } } } else { $msg = JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION'); $response = array('status' => '0', 'error' => $msg); echo json_encode($response); return; } } }
echo '<div class="pg-cv-name pg-cv-folder">' . PhocaGalleryText::wordDelete($cv->title, $this->tmpl['char_cat_length_name'], '...') . '</div>'; } } // Image Name if ($cv->type == 2) { if ($cv->display_name == 1) { echo '<div class="pg-cv-name">' . PhocaGalleryText::wordDelete($cv->title, $this->tmpl['charlengthname'], '...') . '</div>'; } if ($cv->display_name == 2) { echo '<div class="pg-cv-name"> </div>'; } } // Rate Image if ($cv->item_type == 'image') { if ($this->tmpl['display_rating_img'] == 2) { echo PhocaGalleryRateImage::renderRateImg($cv->id, $this->tmpl['display_rating_img'], 1); } else { if ($this->tmpl['display_rating_img'] == 1) { echo '<div><a class="' . $cv->buttonother->methodname . '" title="' . JText::_('COM_PHOCAGALLERY_RATE_IMAGE') . '"' . ' href="' . JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $cv->catslug . '&id=' . $cv->slug . $this->tmpl['tmplcom'] . '&Itemid=' . $this->itemId) . '"'; echo PhocaGalleryRenderFront::renderAAttributeOther($this->tmpl['detail_window'], $cv->buttonother->optionsrating, $this->tmpl['highslideonclick'], $this->tmpl['highslideonclick2']); echo ' >'; echo '<div><ul class="star-rating-small">' . '<li class="current-rating" style="width:' . $cv->voteswidthimg . 'px"></li>' . '<li><span class="star1"></span></li>'; for ($iV = 2; $iV < 6; $iV++) { echo '<li><span class="stars' . $iV . '"></span></li>'; } echo '</ul></div>' . "\n"; echo '</a></div>' . "\n"; } } } if ($cv->display_icon_detail == 1 || $cv->display_icon_download > 0 || $cv->display_icon_vm || $cv->start_cooliris == 1 || $cv->trash == 1 || $cv->publish_unpublish == 1 || $cv->display_icon_geo == 1 || $cv->display_icon_commentimg == 1 || $cv->camera_info == 1 || $cv->display_icon_extlink1 == 1 || $cv->display_icon_extlink2 == 1 || $cv->camera_info == 1) {