getGUID();
try {
$obj = waramu_getResource('', $rid);
setResourceStat($rid, 'read');
$localdat = waramu_isInLocalQueue($rid);
$modnotice = null;
if ( $localdat && $localdat->status != 1) {
if ( $localdat->status == 0 ) {
/*translation:This resource is waiting for a moderators approval.*/
$modnotice = elgg_echo("koolielu:resource_waiting_for_approval");
} else if ( !$obj->isPublished() && $localdat->status == 2 ) {
/*translation:This resource has been rejected by subject moderator.*/
$modnotice = elgg_echo("koolielu:resource_rejected_message");
}
}
if (!$localdat && !$obj->isPublished()) {
/*translation:This resource is not published.*/
$modnotice = elgg_echo("koolielu:resource_not_published");
}
if (!is_null($modnotice) ) {
$c .= '
';
$c .= $modnotice;
$c .= '
';
}
} catch ( Exception $e ) {
$obj = null;
/*translation:Resource you requested does not exist!*/
$errmsg = elgg_echo("koolielu:err_resource_doesnt_exist");
$c .= $errmsg;
}
if ( $obj ) {
$stats = getResourceStat($rid);
$c .= "".$obj->getTitle()." ";
$c .= '';
$title = $obj->getTitle();
// Files part
if (1==1) {
$files .= '';
}
$c .= '';
/* if has quality_marks display pictures here */
$given_quality_marks = getResourceQualityMarks($obj->uid);
foreach ($given_quality_marks as $mark) {
$qmark = get_data_row("SELECT * FROM {$CONFIG->dbprefix}koolielu_quality_marks WHERE ID = {$mark->quality_mark_id}");
$c .= ' ';
}
$is_favorite = isFavoriteResource($rid);
$my_kws = "";
if ( $is_favorite ) {
$c .= " ";
if ($is_favorite[0]->keywords) {
/*translation:My keywords*/
$favorites .= ' ' . elgg_echo("koolielu:waramuresource_my_keywords") . ':
';
}
}
$c .= "";
$c .= '';
$c .= '';
$c .= '';
$c .= '';
$added_date = sprintf(date("d.m.Y", $obj->getDate()));
$oown = $obj->getOwnerPrintable();
if ($oown[0] != null) {
$owner_link= " wwwroot}pg/profile/{$oown[0]->username}\">{$oown[1]} ";
} else {
$owner_link = " ".$oown[1]." ";
}
/*translation:Added by*/
$c .= elgg_echo("koolielu:Added_by") . $owner_link . " " . $added_date;
$statistics .= "";
/*translation:Statistics*/
$statistics .= "
".elgg_echo('koolielu:Statistics').": ";
/*translation:viewed*/
$statistics .= "
".elgg_echo("koolielu:viewed")." ";
/*translation:times*/
$statistics .= $stats['read']." ".elgg_echo("koolielu:n_times")."
";
/*translation:used*/
$statistics .= "
".elgg_echo("koolielu:used")." ".$stats['url'];
/*translation:times*/
$statistics .= " ".elgg_echo("koolielu:n_times")."
";
/*translation:marked as favourite*/
$statistics .= "
".elgg_echo("koolielu:marked_as_fav")." ";
if ($stats['favorite']>0) {
/*translation:times*/
$statistics .= "
".$stats['favorite']." ".elgg_echo("koolielu:n_times");
/*translation:These people like it also*/
$statistics .= "
".elgg_echo("koolielu:also_like")."
";
// list of likers
$ls = 0;
foreach ( listFavoriteLikers($rid) as $liker ){
$uo = get_user($liker->userid);
$statistics .="".$uo->name." ";
// if more than 15 likers then
if ($ls>15) {
break;
}
$ls++;
}
$statistics .=" ";
$statistics .= <<< EOT
EOT;
} else {
$statistics .= $stats['favorite'];
}
$statistics .= "
";
/*translation:Added to collection %s times*/
$statistics .= "
".sprintf(elgg_echo("koolielu:added_to_colls_n_times"), count($obj->getCollectionIDs()))."
";
$statistics .= "
";
if ( !strcmp(getCollectionSchema(), $obj->getSchema())) {
$viewer = new CollectionView();
} else if (!strcmp(getMediaSchema(), $obj->getSchema())) {
$viewer = new MediaView();
} else {
$viewer = new FieldsView();
}
$c .= $viewer->generate_view($obj, array('files' => $files));
$suitable_for_student = $obj->getAnnotationByName('indpwork');
$competition_resource = $obj->getAnnotationByName('keecm');
$tiger_leap_supported = $obj->getAnnotationByName('thsupport');
if ($suitable_for_student != null && $suitable_for_student->value() == "1") {
/*translation:Suitable for student*/
$c .= ''.elgg_echo('koolielu:suitable_student').'
';
}
if ($competition_resource != null && $competition_resource->value() == "1") {
/*translation:Competition resource*/
$c .= ''.elgg_echo('koolielu:competion_resource').'
';
}
if ($tiger_leap_supported != null && $tiger_leap_supported->value() == "1") {
/*translation:Created with support from Tiger Leap Foundation*/
$c .= ''.elgg_echo('koolielu:tiger_leap_supported').'
';
}
// fields end
$c .= '';
// give quality mark area
if ( isModerator($obj->getCurriculumSubjects())) {
$quality_marks = <<< EOT
EOT;
$quality_marks .= "";
/*translation:Quality marks*/
$quality_marks .= " ";
$quality_marks .= "
";
$all_quality_marks = getAllQualityMarks($obj->uid);
$all_marks = $all_quality_marks['all_quality_marks'];
$res_marks = $all_quality_marks['resource_quality_marks'];
$quality_marks .= '';
$quality = "";
$quality .= elgg_view('input/checkboxes', array('internalname' => 'quality_marks', 'options' => $all_marks, 'value' => $res_marks));
/*translation:Save*/
$quality .= elgg_view('input/submit', array('internalname' => 'quality_mark_save_button', 'value' => elgg_echo('koolielu:Save')));
$quality .= elgg_view('input/hidden', array('internalname' => 'resourceid', 'value' => $obj->uid));
/*translation:Cancel*/
$quality .= ' ';
$quality_marks .= elgg_view("input/form", array("action" => "{$CONFIG->wwwroot}action/waramu/save_quality_marks", "body" => $quality));
$quality_marks .= '
';
}
if ( isEditor()) {
$is_featured = isFrontPageResource($rid);
if (!$is_featured) {
/*translation:Display in front page*/
$frontpage_button = ' ';
} else {
$ts = time();
$token = generate_action_token($ts);
$frontpage_button = '';
$frontpage_button .= elgg_view('output/confirmlink', array(
'href' => $CONFIG->wwwroot . 'action/waramu/remove_frontpage_resource?resourceid=' . $rid . '&__elgg_token=' . $token . '&__elgg_ts=' . $ts,
/*translation:Remove from front page*/
'text' => elgg_echo("koolielu:remove_from_frontpage"),
/*translation:Are you sure you want to remove this material from front page?*/
'confirm' => elgg_echo("koolielu:remove_from_frontpage_confirm")
));
$frontpage_button .= "
";
}
}
// collection button form - viewable only for logged in users
if (isloggedin()) {
/*translation:Add to collection*/
$cb = ' ';
$cb .= '
';
$cb .= '';
/*translation:Please choose a collection(s) you wish to add a resource*/
$cb .= '';
/*translation:Your request is being processed, please wait...*/
$cb .= '
'.elgg_echo("koolielu:please_wait").'
';
$cb .= '';
$cb .= '
';
}
$has_collections = count($obj->getCollectionIDs()) > 0;
$collections = '";
$collections .= '
';
// resource collections
if ($has_collections) {
/*translation:Collections*/
$p = array('limit' => 5, 'mode' => 'miniview', 'use_pagination' => false, 'silent_err' => true);
$collections_list .= waramu_list_resources($obj->getCollectionIDs(), false, true, $p);
if (strlen($collections_list) == 0)
$has_collections = false;
$collections .= $collections_list;
if (count($obj->getCollectionIDs())> 5) {
$res_colls_url = $CONFIG->wwwroot . "pg/waramu/collections/?resource_id=".$obj->uid;
/*translation:more...*/
$collections .= "
";
}
} else {
}
$collections .= '
';
$collections .= '
';
$right_side .= $statistics;
$right_side .= $favorites;
$right_side .= $quality_marks;
$right_side .= $frontpage_button;
$right_side .= $cb;
if ($has_collections)
$right_side .= $collections;
$mods = elgg_view("waramu/moderators", array('eid' => $obj->getCurriculumSubjects()));
} else {
/*
$c = $errmsg;
system_messages($errmsg, "errors");
forward($CONFIG->wwwroot.'pg/waramu/index');
*/
}
}
$body = elgg_view_layout('three_columns', "", $c, $right_side.$mods);
page_draw($title, $body);
?>