url.'mod/waramu/waramu.js">'; $b = new Browser(array()); if (empty($subject_id)) { /*translation:Subjects*/ $title = elgg_echo("koolielu:subjects_page_Subjects"); $c_subjpages = ""; /*translation:Subject pages*/ $c_subjpages .= "

" . elgg_echo("koolielu:waramu_subject_pages") . "

"; $c_subjpages .= "
"; $subcount = array(); $smax = -1; $smin = 9999999; foreach( getSubjects() as $sub => $v) { $s = getCurriculumSubject(getSubjectOnDefault($sub)); $b->v['curriculumSubject'] = $s[0]->eid; try { $ocount = $b->doQuery("count"); if ( $ocount > $smax ) $smax = $ocount; if ( $ocount < $smin ) $smin = $ocount; $subcount[] = array($ocount, $sub, $v, $ocount); } catch ( Exception $e ) { } } if (sizeof($subcount) > 0) { $c_subjpages .= ""; $devider = intval(sizeof($subcount)/3); $table_subcount = array(); if (sizeof($subcount)%3 == 0) { $table_subcount[] = array_slice($subcount, 0, $devider); $table_subcount[] = array_slice($subcount, $devider, $devider); $table_subcount[] = array_slice($subcount, $devider*2, $devider); } else if (sizeof($subcount)%3 == 1) { $table_subcount[] = array_slice($subcount, 0, $devider+1); $table_subcount[] = array_slice($subcount, $devider+1, $devider+1); $table_subcount[] = array_slice($subcount, $devider*2+2, $devider-1); } else if (sizeof($subcount)%3 == 2) { $table_subcount[] = array_slice($subcount, 0, $devider+1); $table_subcount[] = array_slice($subcount, $devider+1, $devider+1); $table_subcount[] = array_slice($subcount, $devider*2+2, $devider); } for ($i = 0; $i"; $sub = $table_subcount[0][$i]; $c_subjpages .= "wwwroot . "pg/waramu/subjects/".$sub[1]."\">".$sub[2].""; $c_subjpages .=""; // Second if (($i == sizeof($table_subcount[0])) && (sizeof($subcount)%3 == 1 || sizeof($subcount)%3 == 2)) { $c_subjpages .= ""; } else { $c_subjpages .= ""; } // Third if (($i == sizeof($table_subcount[0])) && (sizeof($subcount)%3 == 1)) { $c_subjpages .= ""; } else { $c_subjpages .= ""; } $c_subjpages .= ""; } $c_subjpages .= "
 "; $sub = $table_subcount[1][$i]; $c_subjpages .= "wwwroot . "pg/waramu/subjects/".$sub[1]."\">".$sub[2].""; $c_subjpages .=" "; $sub = $table_subcount[2][$i]; $c_subjpages .= "wwwroot . "pg/waramu/subjects/".$sub[1]."\">".$sub[2].""; $c_subjpages .="
"; } $c_subjpages .= "
"; $c_tagcloud = ""; /*translation:Learning materials*/ $c_tagcloud .= "

" . elgg_echo('koolielu:waramu_learming_materials') . "

"; $c_tagcloud .= "
"; foreach($subcount as $sub) { $tag = $sub[2]; $tac = $sub[0]; if ($tac==0) $tac=0.7; $siz = round((log($tac) / log($smax)) * 100) + 60; $c_tagcloud .= "wwwroot . "pg/waramu/browse2/curriculumSubject/".getSubjectOnDefault($sub[1])."\" style=\"font-size:".$siz."%\" title=\"{$tag} ({$sub[3]})\">".$tag." ({$sub[3]})"; $c_tagcloud .= " "; } $c_tagcloud .= "
"; // Append building block to main content holder $c .= $c_tagcloud; $c .= elgg_view('object/search'); $c .= $c_subjpages; } else { $real_subject = getSubjectOnDefault($subject_id); $title = $real_subject->title; $c .= "

" . $real_subject->title ."

"; $subjects_main = ""; // Left side $subjects_main .= ""; $subjects_main .= "
"; // Learning materials part $b->v['curriculumSubject'] = $real_subject; $b->v['_sort'] = 'created'; $b->v['_limit'] = 5; $ids = $b->doQuery('list_of_ids', true); unset($b->v['_limit']); unset($b->v['_sort']); if (is_array($ids) && sizeof($ids) > 0) { // Heading $subjects_main .= ""; // Content $subjects_main .= "
"; $subjects_main .= waramu_list_resources($ids, false); $subjects_main .= "
"; } // Groups part $groups = get_entities_from_metadata("subjects", $subject_id, "group", "", 0, 5); if (!empty($groups)) { // Heading $subjects_main .= "
"; /*translation:Groups*/ $subjects_main .= ""; $subjects_main .= "
"; // Content $subjects_main .= "
"; $subjects_main .= "
"; foreach ($groups as $group) { $icon = elgg_view("groups/icon", array('entity' => $group, 'size' => 'small')); $subjects_main .= "
" . $icon . "

" . $group->name . "
"; $subjects_main .= $group->briefdescription . "

"; } $subjects_main .= "
"; $subjects_main .= "
"; } // Tools part $tools = list_entities_from_metadata("subjects", $subject_id, "object", "tool", 0, 5, false, false, false); if (!empty($tools)) { // Heading $subjects_main .= "
"; /*translation:Tools*/ $subjects_main .= ""; $subjects_main .= "
"; $subjects_main .= "
"; $subjects_main .= $tools; $subjects_main .= "
"; } // Right side $subjects_main .= "
"; // News part $news = list_entities_from_metadata_multi(array("subjects" => $subject_id, "approved" => "1", "archived" => "0"), "object", "news", 0, 5, false, false, false); if (!empty($news)) { // Heading $subjects_main .= "
"; /*translation:News*/ $subjects_main .= ""; $subjects_main .= "
"; // Content $subjects_main .= "
"; $subjects_main .= $news; $subjects_main .= "
"; } // Courses part $courses = list_entities_from_metadata_multi(array("subjects" => $subject_id, "approved" => "1", "archived" => "0"), "object", "course", 0, 5, false, false, false); if (!empty($courses)) { // Heading $subjects_main .= "
"; /*translation:Courses*/ $subjects_main .= ""; $subjects_main .= "
"; // Content $subjects_main .= "
"; $subjects_main .= $courses; $subjects_main .= "
"; } // Job_ads section $job_ads = list_entities_from_metadata_and_subtypes(array("subjects" => $subject_id, "approved" => "1", "archived" => "0"), "object", array("job_offering", "job_wanted_ad"), 0, 5, false, false, false); if (!empty($job_ads)) { // Heading $subjects_main .= "
"; /*translation:Job ads*/ $subjects_main .= ""; $subjects_main .= "
"; // Content $subjects_main .= "
"; $subjects_main .= $job_ads; $subjects_main .= "
"; } $subjects_main .= "
"; $subjects_menu = "
"; // Subject moderator $moderators = getAllModerators($subject_id); if (!empty($moderators)) { $subjects_menu .= "
"; /*translation:Moderators*/ $subjects_menu .= ""; foreach ($moderators as $moderator) { $subjects_menu .= "
"; $subjects_menu .= ""; $subjects_menu .= "
 getURL() . "\">" . $moderator->name . ""; if (is_plugin_enabled('messages') && isLoggedIn()) { /*translation:Contact*/ $subjects_menu .= " wwwroot . "mod/messages/send.php?send_to=" . $moderator->guid . "\"> " . elgg_echo("koolielu:Contact") . ""; } $subjects_menu .= "
"; $subjects_menu .= "
"; $subjects_menu .= "
"; } $subjects_menu .= "
"; } // Calendar $subjects_calendar = elgg_view("koolielu/calendar_view", array("year" => date("Y", time()), "month" => date("n", time()), "is_small" => true, "is_scrollable" => true, "subject_filter" => array("subjects" => array($subject_id))) ); $subjects_menu .= $subjects_calendar; $subjects_menu .= "
"; // Logos // Adding logos manage,ent menu, if user has enough privileges $subjects_postmenu .= "
"; if (isModerator($subject_id)) { /*translation:Manage logos*/ $subjects_postmenu .= "
" . elgg_echo("koolielu:menu_manage_subject_logos"). "
"; } $this_subj_logos = elgg_view("koolielu/frontpage_logos_view", array("placeid" => "logos_subject_{$subject_id}", "pageid" => "subject_{$subject_id}")); if ($this_subj_logos) { $subjects_postmenu .= "
" . $this_subj_logos. "
"; } $subjects_postmenu .= "
"; $c .= $subjects_main; if (isModerator($subject_id)) { // Logos on subject page /*translation:Do you really want to delete this logo?*/ $del_question = elgg_echo("koolielu:really_delete_logo"); $subj_logos = ""; $subj_logos .= << $(document).ready(function(){ // Populate logos area populate_contents_area(); }); // Delete logo function delete_logo(id) { var want_to = confirm("$del_question"); if (want_to) { var data = "id=" + id; $.ajax({ EOT; $subj_logos .= "url: \"" . $CONFIG->wwwroot . "mod/koolielu/actions/delete_logo.php\","; $subj_logos .= <<wwwroot ."mod/koolielu/actions/serve_area_logos.php\","; $subj_logos .= << EOT; $subj_logos .= "
"; $subj_logos .= "
"; $subj_logos .= elgg_view('waramu/forms/manage_subject_logos'); $subj_logos .= "
"; $subj_logos .= "
"; $subj_logos .= "
"; $c .= $subj_logos; } } $body = elgg_view_layout('two_column_left_sidebar', $subjects_menu, $c, $subjects_postmenu); page_draw($title, $body); ?>