Example #1
0
foreach ($mmediam as $mmm) {
    $vector[] = $mmm->id;
}
$value_optiono = JRequest::getVar("v", "0");
if ($program->is_final == 0) {
    $value_option = 0;
} else {
    $value_option = 1;
}
if ($program->id == 0) {
    $value_option = $value_optiono;
}
$mainmedia = $this->mainmedia;
$configuration = guruAdminModelguruQuiz::getConfigs();
$amount_quest = guruAdminModelguruQuiz::getAmountQuestions($program->id);
$amount_quest_quizzes = guruAdminModelguruQuiz::getAmountQuizzes($program->id);
$listDirn = "asc";
$listOrder = "ordering";
$saveOrderingUrl = 'index.php?option=com_guru&controller=guruQuiz&task=saveOrderQuestions&tmpl=component';
JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
$db = JFactory::getDBO();
$sql = "Select datetype FROM #__guru_config where id=1 ";
$db->setQuery($sql);
$format_date = $db->loadColumn();
$dateformat = $format_date[0];
$format = "%m-%d-%Y";
switch ($dateformat) {
    case "d-m-Y H:i:s":
        $format = "%d-%m-%Y %H:%M:%S";
        break;
    case "d/m/Y H:i:s":
Example #2
0
			<tr class="camp0"> 
	   			<td><?php 
        echo $file->id;
        ?>
</td>		
	    		<td><a onmouseover="loadprototipe()" onclick="<?php 
        echo $link;
        ?>
" href="#"><?php 
        echo $file->name;
        ?>
</a></td>	
				<td>
                	<?php 
        include_once JPATH_SITE . "/administrator/components/com_guru/models/guruquiz.php";
        $howManyQuestions = guruAdminModelguruQuiz::QuestionNo($id);
        echo $howManyQuestions;
        ?>
                </td>	
				<td><?php 
        if ($published == 1) {
            echo '<img src="components/com_guru/images/tick.png" alt="Published" />';
        } else {
            echo '<img src="images/publish_x.png" alt="Unpublished" />';
        }
        ?>
				</td>		
			</tr>
		<?php 
    }
    // endif for MEDIA check
Example #3
0
</th>
                <th><?php 
echo JText::_("GURU_QUIZ_SCORE");
?>
</th>
            </thead>
            <tbody>
            	<?php 
$new_id = 0;
$nr = 1;
$db = JFactory::getDBO();
for ($i = 0; $i < $n; $i++) {
    $ad = $this->ads[$i];
    $id = $ad->id;
    $date_taken_quiz = guruAdminModelguruQuiz::DataTaken($quiz_id, $id, $ad->tq_id);
    $score_quiz_taken = guruAdminModelguruQuiz::getScoreQuizTaken($quiz_id, $id, $ad->tq_id);
    $score_quiz_taken = explode("|", $score_quiz_taken);
    $score_quiz_taken = intval($score_quiz_taken[0] / $score_quiz_taken[1] * 100);
    ?>
                    <tr class="row<?php 
    echo $k;
    ?>
"> 
                        <td><?php 
    echo $ad->firstname;
    ?>
</td>		
                        <td><?php 
    echo $ad->lastname;
    ?>
</td>		
Example #4
0
# com_guru
# ------------------------------------------------------------------------
# author    iJoomla
# copyright Copyright (C) 2013 ijoomla.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.ijoomla.com
# Technical Support:  Forum - http://www.ijoomla.com/forum/index/
-------------------------------------------------------------------------*/
defined('_JEXEC') or die('Restricted access');
$doc = JFactory::getDocument();
$doc->addScript('components/com_guru/js/jquery-1.9.1.min.js');
$doc->addScript('components/com_guru/js/jquery.noconflict.js');
$doc->addScript('components/com_guru/js/jquery.DOMWindow.js');
$ins_id = guruAdminModelguruQuiz::id_for_last_question();
$ins_id = $ins_id + 1;
$configuration = guruAdminModelguruQuiz::getConfigs();
$temp_size = $configuration->lesson_window_size_back;
$temp_size_array = explode("x", $temp_size);
$width = $temp_size_array["1"] - 20;
$height = $temp_size_array["0"] - 20;
?>

<script type="text/javascript" language="javascript">
	
	function addquestion (qid, idu) {
		var completed = 0;
		var qqqqid=<?php 
echo intval($_GET['cid'][0]);
?>
;
		for(i=1; i<=10; i++){
Example #5
0
		color:#006633;
		font-weight:bold;
	}
	div.modal-body{
		height:700px;
		max-height:700px;
	}
</style>
<?php 
$k = 0;
$n = count($this->ads);
$quiz_id = intval(JRequest::getVar("quiz_id", ""));
$user_id = intval(JRequest::getVar("cid", ""));
$course_id = JRequest::getVar("pid", "0");
$id = JRequest::getVar("id", "0");
$quiz_name = guruAdminModelguruQuiz::getQuizName($quiz_id);
$database = JFactory::getDBO();
$db = JFactory::getDBO();
$helperclass = new guruAdminHelper();
$configs = guruAdminModelguruTask::getConfigs();
$quiz_form_content = "";
$sql = "SELECT show_countdown, max_score, questions_per_page, time_quiz_taken, is_final FROM #__guru_quiz WHERE id=" . intval($quiz_id);
$database->setQuery($sql);
$result = $database->loadObject();
$sql = "SELECT  `score_quiz` FROM #__guru_quiz_question_taken_v3 WHERE user_id=" . intval($user_id) . " and quiz_id=" . intval($quiz_id) . " and pid=" . intval($course_id) . " and id=" . intval($id) . " ORDER BY id DESC LIMIT 0,1";
$database->setQuery($sql);
$result_calc = $database->loadObject();
$sql = "SELECT `question_ids` FROM  #__guru_quiz_question_taken_v3 WHERE user_id=" . intval($user_id) . " and quiz_id=" . intval($quiz_id) . " and pid=" . intval($course_id) . " ORDER BY id DESC LIMIT 0,1 ";
$database->setQuery($sql);
$question_ids_taken_by_user = $database->loadColumn();
$question_ids_taken_by_user = $question_ids_taken_by_user["0"];
Example #6
0
$n = count($this->ads);
$quiz_id = intval(JRequest::getVar("quiz_id", ""));
$user_id = intval(JRequest::getVar("cid", ""));
$id = intval(JRequest::getVar("id", ""));
$quiz_name = guruAdminModelguruQuiz::getQuizName($quiz_id);
$score = guruAdminModelguruQuiz::getScoreQuiz($quiz_id, $user_id, $id);
$score = explode("|", $score);
$how_many_right_answers = $score[0];
$number_of_questions = $score[1];
$score = intval($how_many_right_answers / $number_of_questions * 100);
//$score = $how_many_right_answers.'/'.$number_of_questions;
$ans_gived = guruAdminModelguruQuiz::getAnsGived($user_id, $id);
$ans_right = guruAdminModelguruQuiz::getAnsRight($quiz_id);
$the_question = guruAdminModelguruQuiz::getQuestionName($id, $quiz_id);
$all_answers_array = guruAdminModelguruQuiz::getAllAns($quiz_id, $id);
$all_answers_text_array = guruAdminModelguruQuiz::getAllAnsText($quiz_id, $id);
foreach ($the_question as $i => $question) {
    if (!isset($all_answers_array[$i])) {
        continue;
    }
    $answer_count = 0;
    $all_answers_array_result = explode("|||", $all_answers_array[$i]);
    $all_answers_text_array_result = explode("|||", $all_answers_text_array[$i]);
    $ans_right_result = explode("|||", $ans_right[$i]->answers);
    $ans_gived_result = explode(" ||", $ans_gived[$i]->answers_gived);
    for ($t = 0; $t < count($ans_gived_result); $t++) {
        if ($ans_gived_result[$t] != "") {
            if (!in_array($ans_gived_result[$t], $ans_right_result)) {
                $gasit = false;
                break;
            } else {
Example #7
0
</th>
						<th width="15%"><?php 
echo JText::_('GURU_QUIZ_SCORE');
?>
</th>
						<th width="15%"><?php 
echo JText::_('GURU_QUIZ_SHOW_RESULTS');
?>
</th>
                    </tr>
                </thead>                
                <tbody>
                <?php 
for ($i = 0; $i < $n; $i++) {
    $value = $this->ads;
    $quiz_name = guruAdminModelguruQuiz::getQuizName($value[$i]->quiz_id);
    $score = $value[$i]->score_quiz;
    $score = explode("|", $score);
    $how_many_right_answers = $score[0];
    $number_of_questions = $score[1];
    $score = $how_many_right_answers . '/' . $number_of_questions;
    ?>
                    <tr colspan="4"> 
                         <td align="center"><?php 
    echo $quiz_name;
    ?>
</td>		
                         <td align="center"><?php 
    echo date("" . $format_date . "", strtotime($value[$i]->date_taken_quiz));
    ?>
</td>  
Example #8
0
<?php

/*------------------------------------------------------------------------
# com_guru
# ------------------------------------------------------------------------
# author    iJoomla
# copyright Copyright (C) 2013 ijoomla.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.ijoomla.com
# Technical Support:  Forum - http://www.ijoomla.com/forum/index/
-------------------------------------------------------------------------*/
defined('_JEXEC') or die('Restricted access');
$doc = JFactory::getDocument();
$medias = $this->medias;
$medians = $this->medians;
$guruAdminModelguruQuiz = new guruAdminModelguruQuiz();
$ins_id = $guruAdminModelguruQuiz->id_for_last_question();
$ins_id = $ins_id + 1;
$question_type = JRequest::getVar("type", "");
$find_true = "";
$find_false = "";
$image = "";
$media_attached_to_question = $guruAdminModelguruQuiz->getMediaFromQuestion(@$medias->media_ids);
$is_new = JRequest::getVar("new_add", "0");
$array_elements = array();
?>
<style>
	.gbtn-success {
		background: none repeat scroll 0 0 #87b87f !important;
		border:  1px solid #87b87f !important;
		color: #fff !important;
Example #9
0
 function exportFilePdf()
 {
     while (ob_get_level()) {
         ob_end_clean();
     }
     header("Content-Encoding: None", true);
     require JPATH_COMPONENT . DS . 'helpers' . DS . 'fpdf.php';
     include_once JPATH_COMPONENT . DS . 'helpers' . DS . 'font' . DS . 'helvetica.php';
     $quiz_id = intval(JRequest::getVar("id", ""));
     //create a FPDF object
     $pdf = new FPDF();
     //set font for the entire document
     $pdf->SetFont('Arial', 'B', 20);
     $pdf->SetTextColor(50, 60, 100);
     //set up a page
     $pdf->AddPage();
     $pdf->SetDisplayMode(real, 'default');
     $pdf->SetXY(10, 5);
     $pdf->SetFontSize(8);
     $db = JFactory::getDBO();
     $sql = "select name from #__guru_quiz where id=" . $quiz_id;
     $db->setQuery($sql);
     $name = $db->loadColumn();
     $name = $name["0"];
     $pdf->Write(5, 'Student Quiz Result for ' . "'" . $name . "'");
     $pdf->SetXY(10, 15);
     $pdf->SetFontSize(8);
     $pdf->Cell(20, 10, 'Times', 1, 0, 'C', 0);
     $pdf->Cell(20, 10, 'Students', 1, 0, 'C', 0);
     $pdf->Cell(20, 10, 'Avg Score', 1, 0, 'C', 0);
     //display the title with a border around it
     $res = guruAdminModelguruQuiz::NbOfTimesandStudents($quiz_id);
     $z = 25;
     $scoresByUserId = array();
     $maxNoOfTimes = 0;
     for ($i = 0; $i < count($res); $i++) {
         $newElem = new stdClass();
         $newElem->user_id = $res[$i]["user_id"];
         $newElem->scores = explode(",", $res[$i]["score_by_user"]);
         if (count($newElem->scores) > $maxNoOfTimes) {
             $maxNoOfTimes = count($newElem->scores);
         }
         array_push($scoresByUserId, $newElem);
     }
     $newvect = array();
     for ($i = 0; $i < $maxNoOfTimes; $i++) {
         $newElem = new stdClass();
         $newElem->noOfTimes = $i + 1;
         $newElem->noOfStudents = 0;
         $newElem->sumScores = 0;
         for ($j = 0; $j < count($scoresByUserId); $j++) {
             if (count($scoresByUserId[$j]->scores) >= $i + 1) {
                 $newElem->noOfStudents += 1;
                 $newElem->sumScores += $scoresByUserId[$j]->scores[$i];
             }
         }
         $newElem->avgScore = $newElem->sumScores / $newElem->noOfStudents;
         array_push($newvect, $newElem);
     }
     for ($i = 0; $i < count($newvect); $i++) {
         if ($i + 1 == 1) {
             $nboftimes = $i + 1 . "st";
         } elseif ($i + 1 == 2) {
             $nboftimes = $i + 1 . "nd";
         } elseif ($i + 1 == 3) {
             $nboftimes = $i + 1 . "rd";
         } elseif ($i + 1 > 3) {
             $nboftimes = $i + 1 . "th";
         }
         $studtot = $newvect[$i]->noOfStudents;
         $avg = intval($newvect[$i]->avgScore * 100);
         $pdf->SetXY(10, $z);
         $pdf->SetFontSize(7);
         $pdf->Cell(20, 10, $nboftimes, 1, 0, 'C', 0);
         $pdf->Cell(20, 10, $studtot, 1, 0, 'C', 0);
         $pdf->Cell(20, 10, $avg, 1, 0, 'C', 0);
         $z += 10;
     }
     $t = $z + 10;
     $pdf->SetXY(10, $t);
     $pdf->SetFontSize(7);
     $pdf->Cell(25, 10, 'First Name', 'LRTB', '', 'L', 0);
     $pdf->Cell(25, 10, 'Last Name', 'LRTB', '', 'L', 0);
     $pdf->Cell(39, 10, 'Email', 'LRTB', '', 'L', 0);
     $pdf->Cell(15, 10, '#', 'LRTB', '', 'L', 0);
     $pdf->Cell(20, 10, 'Username', 'LRTB', '', 'L', 0);
     $pdf->Cell(20, 10, 'Date Taken', 'LRTB', '', 'L', 0);
     $pdf->Cell(20, 10, 'Score', 'LRTB', '', 'L', 0);
     $pdf->Ln();
     //-----------------------------------------
     $pid = JRequest::getVar("pid", 0, 'post', 'int');
     $db = JFactory::getDBO();
     $sql = "select u.id, u.username, u.email, c.firstname, c.lastname, tq.date_taken_quiz, tq.score_quiz, tq.`id` as tq_id  from #__guru_customer c, #__users u, #__guru_quiz_taken tq where c.id=u.id and c.id = tq.user_id and u.id IN (select  user_id from #__guru_quiz_taken where quiz_id=" . $quiz_id . ") and tq.quiz_id=" . $quiz_id . " order by c.id desc";
     $db->setQuery($sql);
     $tmp = $db->loadObjectList();
     $new_id = 0;
     $nr = 1;
     for ($i = 0; $i < count($tmp); $i++) {
         $firstname = $tmp[$i]->firstname;
         $lastname = $tmp[$i]->lastname;
         $username = $tmp[$i]->username;
         $email = $tmp[$i]->email;
         $date = date("d/n/Y ", strtotime($tmp[$i]->date_taken_quiz));
         $score = $tmp[$i]->score_quiz;
         $score = explode("|", $score);
         $score = intval($score[0] / $score[1] * 100);
         if ($tmp[$i]->id == $new_id) {
             $nr = $nr + 1;
         } else {
             $nr = 1;
         }
         if ($nr == 1) {
             $nr = $nr . "st";
         } elseif ($nr == 2) {
             $nr = $nr . "nd";
         } elseif ($nr == 3) {
             $nr = $nr . "rd";
         } elseif ($nr > 3) {
             $nr = $nr . "td";
         }
         $pdf->SetFontSize(7);
         $pdf->Cell(25, 10, $firstname, 'LRTB', '', 'L', 0);
         $pdf->Cell(25, 10, $lastname, 'LRTB', '', 'L', 0);
         $pdf->Cell(39, 10, $email, 'LRTB', '', 'L', 0);
         $pdf->Cell(15, 10, $nr, 'LRTB', '', 'L', 0);
         $pdf->Cell(20, 10, $username, 'LRTB', '', 'L', 0);
         $pdf->Cell(20, 10, $date, 'LRTB', '', 'L', 0);
         $pdf->Cell(20, 10, $score, 'LRTB', '', 'L', 0);
         $pdf->Ln();
         $new_id = $tmp[$i]->id;
     }
     //Output the document
     $pdf->Output('Scores.pdf', 'I');
 }
Example #10
0
/*------------------------------------------------------------------------
# com_guru
# ------------------------------------------------------------------------
# author    iJoomla
# copyright Copyright (C) 2013 ijoomla.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.ijoomla.com
# Technical Support:  Forum - http://www.ijoomla.com/forum/index/
-------------------------------------------------------------------------*/
defined('_JEXEC') or die('Restricted access');
$doc = JFactory::getDocument();
$doc->addStyleSheet("../components/com_guru/css/quiz.css");
$k = 0;
$n = count($this->ads);
$quiz_id = intval(JRequest::getVar("id", ""));
$model_quizz = new guruAdminModelguruQuiz();
$quiz_name = $model_quizz->getQuizName($quiz_id);
$quiz_name = '"' . $quiz_name . '"';
$total_students_quiz = $this->getNrStudentsQuiz();
$total_avg = $this->getTotalAvg();
$db = JFactory::getDBO();
$sql = "Select datetype FROM #__guru_config where id=1 ";
$db->setQuery($sql);
$format_date = $db->loadColumn();
$dateformat = $format_date[0];
?>

    <div id="editcell">
        <table class="table">
		 <tr>
			<span style="font-size:16px; padding-left:10px"><?php 
Example #11
0
    $program_id = $program->id;
}
$lists = $program->lists;
$mmediam = $this->mmediam;
$mainmedia = $this->mainmedia;
$configuration = guruAdminModelguruQuiz::getConfigs();
$temp_size = $configuration->lesson_window_size_back;
$temp_size_array = explode("x", $temp_size);
$width = $temp_size_array["1"] - 20;
$height = $temp_size_array["0"] - 20;
$db = JFactory::getDBO();
$sql = "Select datetype FROM #__guru_config where id=1 ";
$db->setQuery($sql);
$format_date = $db->loadColumn();
$dateformat = $format_date[0];
$amount_quest = guruAdminModelguruQuiz::getAmountQuestions($program->id);
$format = "%m-%d-%Y";
switch ($dateformat) {
    case "d-m-Y H:i:s":
        $format = "%d-%m-%Y %H:%M:%S";
        break;
    case "d/m/Y H:i:s":
        $format = "%d/%m/%Y %H:%M:%S";
        break;
    case "m-d-Y H:i:s":
        $format = "%m-%d-%Y %H:%M:%S";
        break;
    case "m/d/Y H:i:s":
        $format = "%m/%d/%Y %H:%M:%S";
        break;
    case "Y-m-d H:i:s":
Example #12
0
for ($i = 0; $i < $n; $i++) {
    $ad = $this->ads[$i];
    $id = $ad->id;
    $checked = JHTML::_('grid.id', $i, $id);
    /*$checked_array = guruAdminModelguruQuiz::checkbox_construct( $i, $id, $name='cid' );
      $checked_array_expld = explode('$$$$$', $checked_array);
      
      $checked = "";
      
      if(isset($checked_array_expld["0"]) && trim($checked_array_expld["0"]) != ""){
          $checked = $checked_array_expld["0"];
      }*/
    $published = JHTML::_('grid.published', $ad, $i);
    $link = "index.php?option=com_guru&controller=guruQuiz&task=edit&cid[]=" . $id . "&v=" . $ad->is_final . "&e=1";
    $howManyQuestions = guruAdminModelguruQuiz::QuestionNo($id);
    $howManyStudentsQuizz = guruAdminModelguruQuiz::StudentsQuizzNo($id);
    if ($ad->is_final == 1) {
        $type = JText::_('GURU_FINAL_EXAM_QUIZ1');
    } else {
        $type = JText::_('GURU_REGULAR_QUIZ');
    }
    ?>
                    <tr class="row<?php 
    echo $k;
    ?>
"> 
                        <td align="center"><?php 
    echo $checked;
    ?>
<span class="lbl"></span></td>		
                        <td><?php