Esempio n. 1
0
 * Copyrights (c) 2005-2011. iZAP                  *
 * All rights reserved                             *
 * **************************************************
 * @author iZAP Team "<*****@*****.**>"
 * @link http://www.izap.in/
 * Under this agreement, No one has rights to sell this script further.
 * For more information. Contact "Tarun Jangra<*****@*****.**>"
 * For discussion about corresponding plugins, visit http://www.pluginlotto.com/forum/
 * Follow us on http://facebook.com/PluginLotto and http://twitter.com/PluginLotto
 */
//shows the detail view of the result page
$result = $vars['entity'];
?>
<div class="contentWrapper">
  <a href="<?php 
echo izapbase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'result', 'page_owner' => FALSE, 'vars' => array($result->container_guid, $result->guid, elgg_get_friendly_title($result->title))));
?>
">
    <div>
      <div style="float: left; margin-right: 10px; width: 22%">
        #<?php 
echo $result->guid;
?>
      </div>

      <div style="float: left; margin-right: 10px; width: 22%">
        <?php 
echo elgg_view_friendly_time($result->time_created);
?>
      </div>
Esempio n. 2
0
} elseif (preg_match('/audio.+/', $vars['entity']->get_quiz_mime())) {
    echo elgg_view(GLOBAL_IZAP_CONTEST_PLUGIN . '/quiz/audio_view', array('entity' => $vars['entity']));
} elseif (elgg_is_active_plugin(GLOBAL_IZAP_VIDEOS_PLUGIN) && preg_match('/video.+/', $vars['entity']->get_quiz_mime())) {
    echo elgg_view(GLOBAL_IZAP_CONTEST_PLUGIN . '/quiz/video_view', array('entity' => $vars['entity']));
} else {
    echo elgg_view(GLOBAL_IZAP_CONTEST_PLUGIN . '/quiz/simple_view', array('entity' => $vars['entity']));
}
?>
</div>
    <?php 
if ($vars['entity']->canEdit() && elgg_get_logged_in_user_guid() == $vars['entity']->owner_guid) {
    echo IzapBase::controlEntityMenu(array('entity' => $vars['entity'], 'handler' => GLOBAL_IZAP_CONTEST_QUIZ_PAGEHANDLER, 'vars' => array($vars['entity']->container_guid, $vars['entity']->getGUID(), elgg_get_friendly_title($vars['entity']->title))));
} else {
    if (!isset($quiz_metadata_array[$_SESSION['user']->username])) {
        echo izapbase::input('hidden', array('name' => 'quiz[guid]', 'value' => $vars['entity']->guid));
        echo izapbase::input('hidden', array('name' => 'quiz[container_guid]', 'value' => $vars['entity']->container_guid));
        ?>
        <p style="float:right;">
    <?php 
        echo elgg_view('input/submit', array('name' => 'quiz[answer]', 'value' => elgg_echo('izap-contest:quiz:answer')));
        // echo elgg_view('input/submit', array('name' => 'quiz[skip]', 'value' => elgg_echo('izap-contest:quiz:skip')));
        ?>
        </p>
      <?php 
    }
}
?>
    <div class="clearfloat"></div>
  </form>
</div>
Esempio n. 3
0
Izapbase::getAllAccess();
// all answers
$answers_array = unserialize($quiz_entity->options);
$answer_var = elgg_get_logged_in_user_entity()->username . '_answer';
$correct_var = elgg_get_logged_in_user_entity()->username . '_is_correct';
if ($quiz_form['answer'] == 'Answer' && $quiz_entity->correct_option == $quiz_form['correct_option']) {
    $quiz_entity->{$correct_var} = 'yes';
    $_SESSION['challenge'][$challenge_entity->guid]['answers'][$quiz_entity->guid]['is_correct'] = TRUE;
    $_SESSION['challenge'][$challenge_entity->guid]['totals']++;
    $_SESSION['challenge'][$challenge_entity->guid]['total_correct_answers']++;
} else {
    $quiz_entity->{$correct_var} = 'no';
    $_SESSION['challenge'][$challenge_entity->guid]['answers'][$quiz_entity->guid]['is_correct'] = FALSE;
    if ($quiz_form['answer'] == 'Answer') {
        if ($challenge_entity->negative_marking) {
            $_SESSION['challenge'][$challenge_entity->guid]['totals']--;
        }
    } elseif ($quiz_form['skip'] == 'Skip') {
    }
}
$quiz_entity->{$answer_var} = $quiz_form['correct_option'];
// remove access from the user
Izapbase::removeAccess();
$_SESSION['challenge'][$challenge_entity->guid]['answers'][$quiz_entity->guid]['question'] = $quiz_entity->title;
$_SESSION['challenge'][$challenge_entity->guid]['answers'][$quiz_entity->guid]['description'] = $quiz_entity->description;
$_SESSION['challenge'][$challenge_entity->guid]['answers'][$quiz_entity->guid]['solution'] = $quiz_entity->solution;
$_SESSION['challenge'][$challenge_entity->guid]['answers'][$quiz_entity->guid]['answer'] = $answers_array[$quiz_form['correct_option']];
$_SESSION['challenge'][$challenge_entity->guid]['answers'][$quiz_entity->guid]['correct_answer'] = $answers_array[$quiz_entity->correct_option];
$_SESSION['challenge'][$challenge_entity->guid]['qc']++;
forward(izapbase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'play', 'page_owner' => FALSE, 'vars' => array($challenge_entity->guid, elgg_get_friendly_title($challenge_entity->title), false))));
Esempio n. 4
0
<?php

/* * ***********************************************
 * PluginLotto.com                                 *
 * Copyrights (c) 2005-2011. iZAP                  *
 * All rights reserved                             *
 * *************************************************
 * @author iZAP Team "<*****@*****.**>"
 * @link http://www.izap.in/
 * Under this agreement, No one has rights to sell this script further.
 * For more information. Contact "Tarun Jangra<*****@*****.**>"
 * For discussion about corresponding plugins, visit http://www.pluginlotto.com/forum/
 * Follow us on http://facebook.com/PluginLotto and http://twitter.com/PluginLotto
 */
// this page accepts the selected challlenge of the user
izapbase::gatekeeper();
global $CONFIG;
$challenge_form = get_input('challenge');
$challenge_entity = new IzapChallenge($challenge_form['guid']);
Izapbase::getAllAccess();
$user_array = (array) $challenge_entity->accepted_by;
$user_array[] = elgg_get_logged_in_user_guid();
$user_array = array_unique($user_array);
$challenge_entity->accepted_by = array();
$challenge_entity->accepted_by = $user_array;
IzapBase::removeAccess();
// session gets start when user accepts a challenge and playing a challenge
$_SESSION['proper_started'][$challenge_entity->guid] = true;
forward(Izapbase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'play', 'page_owner' => false, 'vars' => array($challenge_entity->guid, elgg_get_friendly_title($challenge_entity->title)))));
Esempio n. 5
0
            $action = IzapBase::input('submit', array('name' => 'submit', 'value' => elgg_echo('izap-contest:challenge:take_now')));
            echo '<div style="float:left">' . elgg_echo('izap-contest:next_attempt') . '</div>';
            echo elgg_view(GLOBAL_IZAP_CONTEST_PLUGIN . '/challenge/timer', array('challenge' => $challenge, 'left_time' => $left_time, 'class' => 'timer2', 'redirect' => current_page_url()));
        }
        if ($time) {
            ?>
          <br/>
          <em>
            <?php 
            echo elgg_echo('izap-contest:challenge:last_attempt') . elgg_view_friendly_time($time);
            ?>
          </em>

          <?php 
        }
    }
    echo elgg_view('output/url', array('href' => izapbase::sethref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'result', 'page_owner' => false, 'vars' => array($challenge->guid, elgg_get_friendly_title($challenge->title)))), 'text' => elgg_echo('izap-contest:challenge:my_results')));
    ?>

    </form>
  </div>
  <br/>
<?php 
}
?>
<div class="contentWrapper">
  <?php 
IzapBase::increaseViews($challenge);
//echo elgg_view(GLOBAL_IZAP_CONTEST_PLUGIN . '/challenge/tabs/index', array('entity' => $challenge));
?>
</div>
Esempio n. 6
0
        <?php 
//echo elgg_echo("tags");
//echo elgg_view("input/tags", array("name" => "attributes[tags]", "value" => $quiz_entity->tags))
?>
      </label>
    </p>


    <?php 
if ($vars['quiz_entity']) {
    echo elgg_view('input/hidden', array('name' => "attributes[guid]", "value" => $quiz_entity->getGUID()));
}
echo elgg_view('input/hidden', array('name' => "attributes[container_guid]", "value" => $vars['container_guid']));
echo elgg_view('input/hidden', array('name' => "attributes[qtype]", "value" => $vars['mtype'] == '' ? 'simple' : $vars['mtype']));
echo elgg_view('input/hidden', array('name' => 'attributes[plugin]', 'value' => GLOBAL_IZAP_CONTEST_PLUGIN));
echo izapbase::input('submit', array('name' => "Submit", "value" => elgg_echo('save')));
?>
  </form>
</div>
<script language="javascript" type="text/javascript">
  var counter=2;
  $('document').ready(function(){
    $("#addmore").click(function(){
      $("#option-array").append('<p id="option'+counter+'"><label><?php 
echo elgg_echo('izap-contest:quiz:option');
?>
<input onblur="leave_corresponding_option('+counter+')" onfocus="focus_corresponding_option('+counter+')" onkeyup="correct_option_label(this.value,'+counter+')" type="text" name="attributes[opt:'+counter+']" class="input-text"></label><a href="javascript:del_options(\''+counter+'\');">Eliminar</a></p>');
      $("#correct-option-array").append('<label id="correct'+counter+'"><input name="attributes[_correct_option]" value="opt:'+counter+'" class="input-radio" type="radio"><span class="izapRadio" id="rlabel'+counter+'">option 1</span> <br /></label>');
      counter++;
      return false;
    });