Exemple #1
0
function printS($id)
{
    $ci =& get_instance();
    $s = new Section();
    $s->get_by_id($id);
    $s->e = anchor($ci->app->app_url('edit/') . $s->id, 'Edit');
    $s->d = anchor($ci->app->app_url('delete/') . $s->id, 'Delete');
    $output = "<li>";
    $output .= $s->id . '|';
    $output .= $s->name;
    $output .= add($id, 0, "add first child for {$s->name}");
    $output .= '|';
    $output .= $s->e;
    $output .= '|';
    $output .= $s->d;
    $c = new Section();
    $c->where('parent_section', $id);
    $c->order_by('sort', 'asc');
    $c->get();
    if (count($c->all) > 0) {
        $output .= "<ul>";
        foreach ($c->all as $item) {
            $output .= printS($item->id);
            $output .= "<li>" . add($id, $item->sort + 1) . "</li>";
        }
        $output .= "</ul>";
    }
    $output .= "</li>";
    return $output;
}
Exemple #2
0
 function get_parents()
 {
     $c = new Section();
     $c->get_by_id($this->id);
     $parents = array();
     while (!empty($c->parent_section)) {
         $c = $c->get_by_id($c->parent_section);
         array_push($parents, $c->id);
     }
     return $parents;
 }
Exemple #3
0
 function get_section()
 {
     $CI =& get_instance();
     $sec = new Section();
     $section_segment = $CI->uri->segment(1);
     if (substr($section_segment, 0, 1) == '+') {
         $sec->get_by_name(substr($section_segment, 1));
     } else {
         $sec->get_by_id($section_segment);
     }
     if (!$sec->exists()) {
         $sec->get_by_id('1');
     }
     return $sec;
 }
Exemple #4
0
 function get_section()
 {
     $CI =& get_instance();
     if ($this->installed()) {
         if (!isset($CI->uri)) {
             $CI->load->library('URI');
         }
         $sec = new Section();
         $sec->get_by_id($CI->uri->segment(1));
         if (!$sec->exists()) {
             $sec->get();
         }
         return $sec;
     }
 }
Exemple #5
0
<?php

require_once "../initialize.php";
$message = "";
if (isset($_POST['sectionid']) && $_POST['sectionid'] != "" && isset($_POST['batchselect']) && $_POST['batchselect'] != "" && isset($_POST['name']) && $_POST['name'] != "") {
    $object = Section::get_by_id($_POST['sectionid']);
    $batch = Batch::get_by_id($_POST['batchselect']);
    $file = new File($_FILES['cover']);
    if ($file->valid) {
        $object->picture = $file->data;
    } else {
        $object->picture = base64_decode($object->picture);
    }
    if ($object->name == $_POST['name'] && $object->batchid == $batch->id) {
        $object->comments = $_POST['comments'];
        $object->about = $_POST['about'];
        $object->advisermessage = $_POST['advisermessage'];
        $object->comments = $_POST['comments'];
        $object->fbcomments = $_POST['fbcomments'];
        $object->enabled = $_POST['enabled'];
        $object->update();
        $log = new Log($session->user_id, $clientip, "WEB", "UPDATED SECTION: " . $object->id);
        $log->create();
        $message = "success";
    } else {
        if ($batch != false && $batch != null && $batch != "") {
            if (!Section::section_exists($_POST['name'], $batch->id)) {
                $object->batchid = $batch->id;
                $object->name = $_POST['name'];
                $object->about = $_POST['about'];
                $object->advisermessage = $_POST['advisermessage'];
Exemple #6
0
     $schooluser->enabled = 1;
     $schooluser->pending = 0;
     $schooluser->create();
     if (isset($_POST['batchselect']) && $_POST['batchselect'] != "NOTHING") {
         $batch = Batch::get_by_id($_POST['batchselect']);
         $batchuser = new BatchUser();
         $batchuser->schoolid = $school->id;
         $batchuser->batchid = $batch->id;
         $batchuser->userid = $object->id;
         $batchuser->level = 0;
         $batchuser->enabled = 1;
         $batchuser->pending = 0;
         $batchuser->create();
     }
     if (isset($_POST['sectionselect']) && $_POST['sectionselect'] != "NOTHING") {
         $section = Section::get_by_id($_POST['sectionselect']);
         $batch = Batch::get_by_id($section->batchid);
         $sectionuser = new SectionUser();
         $sectionuser->sectionid = $section->id;
         $sectionuser->batchid = $batch->id;
         $sectionuser->userid = $object->id;
         $sectionuser->schoolid = $school->id;
         $sectionuser->level = 0;
         $sectionuser->enabled = 1;
         $sectionuser->pending = 0;
         $sectionuser->create();
     }
     $log = new Log($session->user_id, $clientip, "WEB", "CREATED USER: "******"success";
 }
Exemple #7
0
     }
     if (count($bathsImIn) > 0) {
         echo '<li class="divider"> batchs</li>';
         foreach ($bathsImIn as $theuser) {
             $batch = Batch::get_by_id($theuser->batchid);
             if (!$batch) {
                 $theuser->delete();
             }
             $school = School::get_by_id($batch->schoolid);
             echo '<li><a href="#" onclick="invite(\'batchid\', ' . $batch->id . '); return false;">' . $school->name . ' - ' . $batch->get_batchyear() . '</a></li>';
         }
     }
     if (count($sectionsImIn) > 0) {
         echo '<li class="divider"> sections</li>';
         foreach ($sectionsImIn as $theuser) {
             $section = Section::get_by_id($theuser->sectionid);
             if (!$section) {
                 $theuser->delete();
             }
             $school = School::get_by_id($section->schoolid);
             $batch = Batch::get_by_id($section->batchid);
             echo '<li><a href="#" onclick="invite(\'sectionid\', ' . $section->id . '); return false;">' . $school->name . ' - ' . $batch->get_batchyear() . ' - ' . $section->name . '</a></li>';
         }
     }
     echo '
             </ul>
         </div>
         ';
 }
 if ($loggeduser->is_super_admin() || $loggeduser->id == $user->id) {
     echo '
Exemple #8
0
         $notification->itemtype = "batchuser";
         $notification->title = "Invites you";
         $notification->create();
         $response = "success";
     } else {
         $theuser = BatchUser::getUser($user->id, $_GET['batchid']);
         if ($theuser->pending == 0) {
             $response = "This user is already a member.";
         } else {
             $response = "This user is already pending.";
         }
     }
 } else {
     if (isset($_GET['sectionid'])) {
         if (!SectionUser::userExists($user->id, $_GET['sectionid'])) {
             $section = Section::get_by_id($_GET['sectionid']);
             $batch = Batch::get_by_id($section->batchid);
             $school = School::get_by_id($batch->schoolid);
             $object = new SectionUser();
             $object->userid = $user->id;
             $object->schoolid = $school->id;
             $object->batchid = $batch->id;
             $object->sectionid = $section->id;
             $object->level = 0;
             $object->role = "student";
             $object->enabled = 1;
             $object->pending = 1;
             $object->create();
             $notification = new Notification();
             $notification->fromuserid = $session->user_id;
             $notification->touserid = $user->id;
Exemple #9
0
<?php

$ci =& get_instance();
$s = new Section();
$s->get_by_id($ci->input->post('id'));
$s->name = $ci->input->post('name');
$s->view = $ci->input->post('view');
$s->save();
redirect($ci->app->app_url('view'));
             foreach ($sectionadmins as $sectionadmin) {
                 $section = Section::get_by_id($sectionadmin->sectionid);
                 $sectionsselect .= "<option value='" . $section->id . "'>" . $section->name . "</option>";
             }
             if (User::get_by_id($session->user_id)->is_super_admin()) {
                 $sectionsselect .= "<option value='NOTHING'>NOTHING</option>";
             }
         } else {
             $sectionsselect .= "<option value='0'>NO SECTIONS YET</option>";
         }
     }
 } else {
     $sectionadmins = SectionUser::getAdminSections($session->user_id);
     if (count($sectionadmins) > 0) {
         foreach ($sectionadmins as $sectionadmin) {
             $section = Section::get_by_id($sectionadmin->sectionid);
             $sectionsselect .= "<option value='" . $section->id . "'>" . $section->name . "</option>";
         }
         if (User::get_by_id($session->user_id)->is_super_admin()) {
             $sectionsselect .= "<option value='NOTHING'>NOTHING</option>";
         }
     } else {
         $sectionsselect .= "<option value='0'>NO SECTIONS YET</option>";
     }
 }
 if (User::get_by_id($session->user_id)->is_super_admin()) {
     $sectionsselect = "";
     $sections = Section::get_all();
     if (count($sections) > 0) {
         foreach ($sections as $section) {
             $sectionsselect .= "<option value='" . $section->id . "'>" . $section->name . "</option>";
} else {
    if ($_POST['oper'] == 'edit') {
        $section = Section::get_by_id($_POST['id']);
        $section->name = $_POST['name'];
        $section->comments = $_POST['comments'];
        $section->about = $_POST['about'];
        $section->pending = $_POST['pending'];
        $section->enabled = $_POST['enabled'];
        $section->sectionname = $_POST['sectionname'];
        $section->schoolid = $_POST['schoolid'];
        $section->update();
        $log = new Log($session->user_id, $clientip, "WEB", "UPDATED SECTION: " . $_POST['id']);
        $log->create();
    } else {
        if ($_POST['oper'] == 'del') {
            $section = Section::get_by_id($_POST['id']);
            $school = School::get_by_id($section->schoolid);
            $batch = Batch::get_by_id($section->batchid);
            SectionUser::delete_all_by_sectionid($section->id);
            $section->delete();
            $log = new Log($session->user_id, $clientip, "WEB", "DELETED SECTION: " . $_POST['id']);
            $log->create();
        }
    }
}
function rrmdir($dir)
{
    foreach (glob($dir . '/*') as $file) {
        if (is_dir($file)) {
            rrmdir($file);
        } else {
Exemple #12
0
<?php

require_once "header.php";
if (isset($_GET['id'])) {
    $object = Section::get_by_id($_GET['id']);
    if ($object == false || $object == null || $object == "") {
        header("location: index.php");
    } else {
        $batch = Batch::get_by_id($object->batchid);
        $school = School::get_by_id($batch->schoolid);
    }
} else {
    header("location: index.php?negative");
}
if (!$session->is_logged_in()) {
    header("location: index.php?negative");
} else {
    $user = User::get_by_id($session->user_id);
    if ($user->enabled == DISABLED) {
        header("location: index.php?disabled");
    }
    if (!SchoolUser::amIAdmin($session->user_id, $object->schoolid) && !BatchUser::amIAdmin($session->user_id, $object->batchid) && !SectionUser::amIAdmin($session->user_id, $object->id) && !$user->is_super_admin()) {
        header("location: index.php?negative");
    }
}
$pathinfo = pathinfo($_SERVER["PHP_SELF"]);
$basename = $pathinfo["basename"];
$currentFile = str_replace(".php", "", $basename);
?>
<div class="container-fluid">
  <div class="row-fluid">
Exemple #13
0
<?php

$ci =& get_instance();
$ci->load->library('gui');
$id = $ci->uri->segment(5);
$s = new Section();
$s->get_by_id($id);
$hidden = array('id' => $id, 'parent_section' => $s->parent_section, 'sort' => $s->sort);
echo $ci->gui->form($ci->app->app_url('editaction'), array('Name :' => $ci->gui->textbox('name', $s->name), 'view' => $ci->gui->textarea('view', $s->view), '' => $ci->gui->button('', 'Edit Section', array('type' => 'submit'))), '', $hidden);
Exemple #14
0
<?php

$content_id = $ci->uri->segment(5);
$content_ins = new Content();
$content_ins->get_by_id($content_id);
if (!$content_ins->exists()) {
    show_error('content not found');
}
$parent_content = new Content();
$parent_content->get_by_id($content_ins->parent_content);
$parent_section = new Section();
$parent_section->get_by_id($content_ins->parent_section);
$data_table = array('Content ID' => $content_ins->id, 'Content path' => $content_ins->path, 'Section' => empty($parent_section->name) ? 'Index' : $parent_section->name, 'Subsections' => $content_ins->subsection ? 'Yes' : 'No', 'Parent' => $parent_content->path, 'Cell' => $content_ins->cell, 'Sort' => $content_ins->sort);
$ci->load->library('gui');
$ci->app->add_info('Content information and the containers');
echo $ci->gui->form('#', $data_table);
?>

<style>
label{
	font-weight: bold;
}
tr{
	border-bottom: 1px solid black;
}
</style>
     }
     $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE BATCHS");
     $log->create();
     $response = "success";
 } else {
     if ($what == "batchuser") {
         foreach ($ids as $id) {
             BatchUser::get_by_id($id)->delete();
         }
         $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE BATCHUSERS");
         $log->create();
         $response = "success";
     } else {
         if ($what == "section") {
             foreach ($ids as $id) {
                 Section::get_by_id($id)->delete();
             }
             $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE SECTIONS");
             $log->create();
             $response = "success";
         } else {
             if ($what == "sectionuser") {
                 foreach ($ids as $id) {
                     SectionUser::get_by_id($id)->delete();
                 }
                 $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE SECTIONUSERS");
                 $log->create();
                 $response = "success";
             } else {
                 if ($what == "pending") {
                     foreach ($ids as $id) {
Exemple #16
0
}
$c->parent_section = $ci->input->post("parent_section");
$c->parent_content = $ci->input->post("parent_content");
$c->cell = $ci->input->post("cell");
$c->sort = $ci->input->post("sort");
$c->path = $ci->input->post("path");
$c->type = $ci->input->post("type");
$c->subsection = $ci->input->post("subsection") == NULL ? FALSE : TRUE;
$c->view = $ci->input->post("view");
$c->addin = $ci->input->post("addin");
$old_edit = $c->can_edit();
$c->edit = $ci->input->post("edit");
$c->del = $ci->input->post("del");
$c->info = $ci->input->post("info");
if (!$ci->input->post("id")) {
    $p = new content();
    $p->get_by_id($c->parent_content);
    $c->attach($ci->vunsy->section, $p, $c->cell, $c->sort);
}
$p = new Section();
$p->get_by_id($c->parent_section);
if ($p->can_addin() and !$ci->input->post("id") or $ci->input->post("id") and $old_edit) {
    $c->save();
    if ($ci->input->post("id")) {
        redirect($ci->app->app_url("data/{$c->id}"));
    } else {
        $ci->app->add_info('Content added');
    }
} else {
    $ci->app->add_error('Permission denied ! please check your root adminstrator for permissions');
}
Exemple #17
0
     $html .= "Now friends";
 } else {
     if ($notification->itemtype == "schooluser") {
         $object = SchoolUser::get_by_id($notification->itemid);
         $school = School::get_by_id($object->schoolid);
         $html .= "Now a member in School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>";
     } else {
         if ($notification->itemtype == "batchuser") {
             $object = BatchUser::get_by_id($notification->itemid);
             $batch = Batch::get_by_id($object->batchid);
             $school = School::get_by_id($object->schoolid);
             $html .= "Now a member in Batch <a href='batch.php?id=" . $batch->id . "'>" . $batch->get_batchyear() . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>";
         } else {
             if ($notification->itemtype == "sectionuser") {
                 $object = SectionUser::get_by_id($notification->itemid);
                 $section = Section::get_by_id($object->sectionid);
                 $batch = Batch::get_by_id($object->batchid);
                 $school = School::get_by_id($object->schoolid);
                 $html .= "Now a member in Section <a href='section.php?id=" . $section->id . "'>" . $section->name . "</a> of Batch <a href='batch.php?id=" . $batch->id . "'>" . $batch->get_batchyear() . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>";
             } else {
                 if ($notification->itemtype == "clubuser") {
                     $object = ClubUser::get_by_id($notification->itemid);
                     $club = Club::get_by_id($object->clubid);
                     $school = School::get_by_id($object->schoolid);
                     $html .= "Now a member in Club <a href='club.php?id=" . $club->id . "'>" . $club->name . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>";
                 } else {
                     if ($notification->itemtype == "groupuser") {
                         $object = GroupUser::get_by_id($notification->itemid);
                         $group = Group::get_by_id($object->groupid);
                         $school = School::get_by_id($object->schoolid);
                         $html .= "Now a member in Group <a href='group.php?id=" . $group->id . "'>" . $group->name . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>";
Exemple #18
0
 function deattach()
 {
     $sec = new Section();
     $sec->get_by_id($this->parent_section);
     $sec->deattach($this);
 }
Exemple #19
0
<?php

require_once "../initialize.php";
$id = $_GET['id'];
$section = Section::get_by_id($id);
$batch = Batch::get_by_id($section->batchid);
SectionUser::delete_all_by_sectionid($section->id);
$section->delete();
$log = new Log($session->user_id, $clientip, "WEB", "DELETED SECTION: " . $section->id);
$log->create();
echo "success";