Skip to content

Commit

Permalink
removed image file width and height limit, fixed the 10Mb file size l…
Browse files Browse the repository at this point in the history
…imit, fixed the unread posts list
  • Loading branch information
anchetaWern committed Apr 9, 2012
1 parent bdf5951 commit 2244fc5
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 21 deletions.
3 changes: 3 additions & 0 deletions application/controllers/class_loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ function selector($page){
$this->load->model('classusers_model');
$classes['invited'] = $this->classusers_model->list_invited_students();

//pending students
$classes['pendings'] = $this->classusers_model->pending_students();

//remove students
$classes['remove'] = $this->classusers_model->class_users();

Expand Down
6 changes: 5 additions & 1 deletion application/controllers/sessions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ function create(){
$this->load->model('sessions_model');
$this->sessions_model->create();
}


function join(){
$this->load->model('sessions_model');
$this->loa
}
}
?>
10 changes: 10 additions & 0 deletions application/controllers/tester.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
class tester extends ci_Controller{
function index(){
$this->load->model('post');
$boom = $this->post->post_title(7, '4');
var_dump($boom);
}

}
?>
4 changes: 2 additions & 2 deletions application/controllers/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function do_upload()

$config['max_size'] = '10240';//10Mb

$config['max_width'] = '1024';
$config['max_height'] = '768';
$config['max_width'] = '0';
$config['max_height'] = '0';

$this->load->library('upload', $config);

Expand Down
6 changes: 3 additions & 3 deletions application/models/assignments_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ function reply(){

$reply = $this->db->query("INSERT INTO tbl_assignmentresponse SET assignment_id=?, user_id=?, res_title=?, res_body=?", $reply_data);
$reply_id = $this->db->insert_id();
$reply_id = 'AR'.$reply_id; //assignment response prefix
$post_id = 'AR'.$assignment_id; //assignment response prefix



$_SESSION['post_id'] = $reply_id;
$_SESSION['post_id'] = 'AR'.$reply_id;//for the files


//fetch teacher for the current class
Expand All @@ -137,7 +137,7 @@ function reply(){

//set response status to unread
$this->load->model('post');
$this->post->message_post($reply_id, 3, $teacher_id);
$this->post->message_post($post_id, 3, $teacher_id);


$this->load->model('email');
Expand Down
19 changes: 19 additions & 0 deletions application/models/classusers_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,25 @@ function expired_classes(){//returns all the classes handled by the current teac
}
return $expired_classes;
}

function pending_students(){
$class_id = $_SESSION['current_class'];
$query = $this->db->query("SELECT tbl_classpeople.user_id, fname, mname, lname FROM tbl_classpeople
LEFT JOIN tbl_userinfo ON tbl_classpeople.user_id = tbl_userinfo.user_id
WHERE class_id = '$class_id' AND status = 0
");
$pendings = array();
if($query->num_rows() > 0){
foreach($query->result() as $row){
$user_id = $row->user_id;
$fname = $row->fname;
$mname = $row->mname;
$lname = $row->lname;
$pendings[] = array('fname'=>$fname, 'mname'=>$mname, 'lname'=>$lname, 'id'=>$user_id);
}
}
return $pendings;
}

}
?>
2 changes: 1 addition & 1 deletion application/models/groups_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function list_all(){//lists all the groups where the current user belongs
$users_group=$this->db->query("SELECT tbl_groups.group_id, group_name, CONCAT_WS(', ', UPPER(lname), fname) AS creator FROM tbl_groups
LEFT JOIN tbl_userinfo ON tbl_groups.group_creator = tbl_userinfo.user_id
LEFT JOIN tbl_grouppeople ON tbl_groups.group_id = tbl_grouppeople.group_id
WHERE tbl_grouppeople.user_id='$user_id' AND class_id='$class_id'");
WHERE tbl_grouppeople.user_id='$user_id' AND class_id='$class_id' AND status = 1");
if($users_group->num_rows() > 0){
foreach($users_group->result() as $row){
$group_id = $row->group_id;
Expand Down
4 changes: 2 additions & 2 deletions application/models/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function unset_quizreply(){
}

function status_id($post_id, $post_from){
$query = $this->db->query("SELECT post_status_id FROM tbl_poststatus WHERE post_id='$post_id' AND post_from='$post_from'");
$query = $this->db->query("SELECT post_status_id FROM tbl_poststatus WHERE post_id='$post_id' AND post_from='$post_from' AND status =1");
if($query->num_rows() > 0){
$row = $query->row();
return $row->post_status_id;
Expand All @@ -147,7 +147,7 @@ function post_type($post_type){//returns the post type from a post_type id

function post_title($post_type, $post_id){//returns the post title from the post_type id and post_id
$post_id_len = strlen($post_id);
if($post_type != 3){
if($post_type != 3 && $post_type != 7){//assignment response and quiz response doesn't have a prefix
$post_id = substr($post_id, 2, $post_id_len);
}
$tables = array('tbl_assignment', 'tbl_handouts', 'tbl_assignmentresponse', 'tbl_quiz', 'tbl_messages', 'tbl_sessions', 'tbl_quizresponse');
Expand Down
11 changes: 11 additions & 0 deletions application/models/quizzes_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,17 @@ function student_reply(){
}


function responseid($user_id, $quiz_id){//quick fix; returns the response id for a specific quiz
$query = $this->db->query("SELECT quizresponse_id FROM tbl_quizresponse WHERE student_id='$user_id' AND quiz_id='$quiz_id'");
$responseid = 0;
if($query->num_rows() >0){
$row = $query->row();
$responseid = $row->quizresponse_id;
}
return $responseid;
}



}
?>
7 changes: 7 additions & 0 deletions application/models/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,22 @@ function unread_post(){//selects all the unread post from all the classes
$class_description = $row->class_description;
$post_type_id = $row->post_type;
$post_id = $row->post_id;
$original_post_id = $post_id;
$post_from = $row->post_from;
$post_type = $this->post->post_type($post_type_id);
$post_time = $row->post_time;

if($post_type_id == 3){//assignment response
$post_id = $this->assignments_model->responseid($row->post_from, substr($post_id, 2, strlen($post_id)));
}else if($post_type_id == 7){//quiz response
$post_id = $this->quizzes_model->responseid($row->post_from, substr($post_id, 2, strlen($post_id)));
}

$post_title = $this->post->post_title($post_type_id, $post_id);
if($post_title == ''){
$post_title = $this->quizzes_model->quiz_details(substr($original_post_id, 2, strlen($original_post_id)));
$post_title = $post_title['title'] . ' Result';
}
$unread_r[] = array('post_from'=>$post_from, 'type_id'=>$post_type_id,'post_id'=>$post_id, 'class_code'=>$class_code,'class_description'=>$class_description,
'post_type'=>$post_type, 'post_time'=>$post_time, 'post_title'=>$post_title);
}
Expand Down
2 changes: 2 additions & 0 deletions application/views/ajax/join_session.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
Session type:
<?php echo $session_types[$session['type']-1]; ?>
</div>
<?php if($session['infinite'] != 1){ ?>
<div id="date">
Date:
<?php echo $session['date']; ?>
Expand All @@ -42,6 +43,7 @@
Time to:
<?php echo date('g:i:s A', strtotime($session['to'])); ?>
</div>
<?php } ?>
<div id="infinite">
Always Accessible:
<?php echo $accessible[$session['infinite']]; ?>
Expand Down
1 change: 1 addition & 0 deletions application/views/ajax/new_classsession.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<h4>Create New <?php echo $session_title; ?> Session</h4>
</div>
<div class="container">
<input type="hidden" id="current_session_type" value="<?php echo $session_title; ?>"/>
<?php
echo form_label('Title', 'ses_title');
echo form_input($title);
Expand Down
10 changes: 8 additions & 2 deletions application/views/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@
</script>
<?php
$session_title = $_SESSION['ses']['title'];
$time_from = date('Y-m-d g:i:s A', strtotime($_SESSION['ses']['from']));
$time_to = date('Y-m-d g:i:s A', strtotime($_SESSION['ses']['to']));
$session_date = date('Y-m-d ', strtotime($_SESSION['ses']['from']));
$time_from = date('g:i:s A', strtotime($_SESSION['ses']['from']));
$time_to = date('g:i:s A', strtotime($_SESSION['ses']['to']));
echo "Session:<a href='/zenoir/index.php/ajax_loader/view/session' class='lightbox'> ". $session_title ."</a><br/>";

if($_SESSION['ses']['infinite'] != 1){

echo "Date ". $session_date. "<br/>";
echo "From: ".$time_from."<br/>";
echo "To: ".$time_to."<br/>";
}
?>
<input type="hidden" id="user_id" value="<?php echo $_SESSION['user_id']; ?>"/><!--id-->
<input type="hidden" id="user_name" value="<?php echo $_SESSION['mask_name']; ?>"/><!--name-->
Expand Down
23 changes: 23 additions & 0 deletions application/views/teachers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<h4>[Classroom Settings]</h4>
<ul class="tabs left">
<li><a href="#invite_students">Invite Students</a></li>
<li><a href="#pending_students">Pending</a></li>
<li><a href="#remove_students">Remove Students</a></li>
<li><a href="#modules">Enable/Disable Modules</a></li>
<li><a href="#email">Email Notifications</a></li>
Expand All @@ -15,6 +16,7 @@
<div id="invite_students" class="tab-content">
<?php
$invites = $table['invited'];
$pendings= $table['pendings'];
$modules = $table['modules'];
$exports = $table['exports'];
$events = $table['events'];
Expand Down Expand Up @@ -51,6 +53,27 @@
<?php } ?>
</div><!--end of invite students-->

<div id="pending_students" class="tab-content">
<?php if(!empty($pendings)){ ?>
<table>
<thead>
<tr>
<th>ID</th>
<th>Student</th>
</tr>
</thead>
<tbody>
<?php foreach($pendings as $row){ ?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo strtoupper($row['lname']) .', '. ucwords($row['fname']) .' '. ucwords($row['mname']); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
</div>

<div id="remove_students" class="tab-content">
<?php if(!empty($remove)){ ?>
<table class="tbl_classes">
Expand Down
29 changes: 20 additions & 9 deletions application/views/templates/class_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ function(){

if(create == 1){
//put the general quiz info on the session
$("#fancybox-content").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$("body").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$.post('/zenoir/index.php/quizzes/create_no', {'quiz_title' : quiz_title, 'quiz_body' : quiz_body, 'start_time' : start_time, 'end_time' : end_time},
function(){
$('#ajax_loader').remove();
Expand Down Expand Up @@ -435,7 +435,7 @@ function(){
});

if(create_quiz == 1){
$("#fancybox-content").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$("body").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$.post('/zenoir/index.php/quizzes/create', {'questions' : questions, 'a' : a, 'b' : b, 'c' : c, 'd' : d, 'answers' : answers},
function(data){
$('#ajax_loader').remove();
Expand Down Expand Up @@ -473,7 +473,7 @@ function(data){
buttons: [
{type: 'button green', text: 'Ok',
click: function(){
$("#fancybox-content").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$("body").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$.post('/zenoir/index.php/quizzes/submit', {'answers' : answers},
function(){
$.noty.close();
Expand Down Expand Up @@ -515,7 +515,7 @@ function(){
buttons: [
{type: 'button green', text: 'Ok',
click: function(){
$("#fancybox-content").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$("body").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$.post('/zenoir/index.php/quizzes/reply', {'title' : title, 'body' : body},
function(){
$.noty.close();
Expand Down Expand Up @@ -657,9 +657,15 @@ function(){
});

$('#create_mcsession').live('click', function(){

var create = 1;
var title = $.trim($('#ses_title').val());
var ses_desc = $.trim($('#ses_body').val());
var sessions_type= $.trim($('#current_session_type').val());
console.log(sessions_type);
if(sessions_type != 'Team'){
console.log('booms');
}
var infinite = 0;

if($('#ses_validity').attr('checked')){
Expand Down Expand Up @@ -692,7 +698,12 @@ function(){
create = 0;
}

if(create == 1 && members != 0){
if(create == 1){
if(sessions_type == 'Team' && members == 0){
noty_err.text = 'Make sure that you are a member of atleast one group before trying to create a Team Session';
noty(noty_err);
}else{

$("#fancybox-content").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$.post('/zenoir/index.php/sessions/create', {'ses_title' : title, 'ses_body' : ses_desc, 'infinite' : infinite,
'time_from' : time_from, 'time_to' : time_to, 'members' : members},
Expand All @@ -706,9 +717,9 @@ function(data){
},1000);

});

}
}else{
noty_err.text = 'All fields are required! Make sure that you are a member of atleast one group before trying to create a Team Session';
noty_err.text = 'All fields are required!';
noty(noty_err);
}
});
Expand All @@ -724,7 +735,7 @@ function(data){
buttons: [
{type: 'button green', text: 'Ok',
click: function(){
$("#fancybox-content").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$("body").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$.post('/zenoir/index.php/classrooms/invites', {'student_id' : invite_id}, function(){
$('#ajax_loader').remove();
$.noty.close();
Expand Down Expand Up @@ -958,7 +969,7 @@ function(){
buttons: [
{type: 'button green', text: 'Yes',
click: function(){
$("#fancybox-content").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$("body").append("<img id='ajax_loader' src='/zenoir/img/ajax-loader.gif' class='centered'/>");
$.post('/zenoir/index.php/classrooms/remove', {'student_id' : student_id},
function(){
$('#ajax_loader').remove();
Expand Down
2 changes: 1 addition & 1 deletion js/jquery.fileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@

validateFileSize: function(file){

if(file.size <= 102040){//10 Mb is the limit
if(file.size <= 10485760){//10 Mb is the limit
return true;
}else{
return false;
Expand Down

0 comments on commit 2244fc5

Please sign in to comment.