コード例 #1
0
ファイル: IzapQuizController.php プロジェクト: socialweb/PiGo
 /**
  * displays the Detail view of the quiz
  */
 public function actionView()
 {
     $id = $this->url_vars[3];
     if (!($quiz_entity = get_entity($id))) {
         forward(IzapBase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'view', 'vars' => array($this->url_vars[2], get_entity($this->url_vars[2])->title))));
     }
     $challenge = get_entity($quiz_entity->container_guid);
     if (elgg_get_logged_in_user_guid() != $challenge->owner_guid && !$challenge->can_play()) {
         forward($challenge->getURL());
     }
     elgg_set_page_owner_guid($challenge->container_guid);
     $title = $quiz_entity->title;
     $this->page_elements['filter'] = '';
     $this->page_elements['title'] = '<a href="' . $challenge->getURL() . '">' . $challenge->title . '</a> ';
     $this->page_elements['page_title'] = $challenge->title;
     $this->page_elements['content'] = '<div class="quiz_answer">' . elgg_echo('izap-contest:quiz', array($quiz_entity->title)) . '</div>';
     $this->page_elements['content'] .= elgg_view(GLOBAL_IZAP_CONTEST_PLUGIN . '/quiz/view', array('entity' => $quiz_entity, 'container_guid' => (int) $this->url_vars[2]));
     $this->drawPage();
 }
コード例 #2
0
ファイル: start.php プロジェクト: socialweb/PiGo
function group_menus_izap_contest()
{
    global $CONFIG;
    $pageowner = elgg_get_page_owner_entity();
    // if the page owner is group and context is group
    if ($pageowner instanceof ElggGroup && (get_context() == 'groups' || get_context() == GLOBAL_IZAP_CONTEST_QUIZ_PAGEHANDLER || get_context() == GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER) && ($pageowner->izapchallenge_enable == 'yes' || empty($pageowner->izapchallenge_enable))) {
        if (can_write_to_container(elgg_get_logged_in_user_guid(), $pageowner->guid)) {
            //elgg_register_menu_item('page', new ElggMenuItem('izap-contest:challenge:group:add',
            //                elgg_echo('izap-contest:challenge:group:add'),
            //                izapbase::setHref(array(
            //                    'context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER,
            //                    'action' => 'add',
            //                    'page_owner' => false,
            //                    'vars' => array($pageowner->username
            //                    )
            //                        )
            //                )
            //        )
            //);
        }
        elgg_register_menu_item('page', new ElggMenuItem('izap-contest:challenge:group:list', elgg_echo('izap-contest:challenge:group:list'), IzapBase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'list', 'page_owner' => false, 'vars' => array($pageowner->guid, $pageowner->username)))));
    }
}
コード例 #3
0
ファイル: marked-spammers.php プロジェクト: socialweb/PiGo
    <?php 
foreach ($users as $user) {
    ?>
    <div>
      <table  class="elgg-table-alt">
        <tbody>
          <tr class="u_row">
            <td><a href="<?php 
    echo $user->getURL();
    ?>
"><?php 
    echo $user->name;
    ?>
</a></td>
            <td><a href="<?php 
    echo IzapBase::setHref(array('context' => 'ajax', 'page_owner' => FALSE, 'vars' => array('view', 'js', 'antispam', 'userstats')));
    ?>
?guid=<?php 
    echo $user->guid;
    ?>
" class="load_user_data" title="<?php 
    echo $user->guid;
    ?>
">View data</a></td>
          </tr>
        </tbody>
      </table>
      <span id="load_user_data_<?php 
    echo $user->guid;
    ?>
"></span>
コード例 #4
0
ファイル: izapchallenge.php プロジェクト: socialweb/PiGo
/* * *************************************************
 * 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
 */
global $CONFIG;
$owner = $vars['entity']->getOwnerEntity();
$video_pic = elgg_view('output/url', array('href' => $vars['entity']->getUrl(), 'text' => $vars['entity']->getThumb()));
$owner_link = elgg_view('output/url', array('href' => IzapBase::setHref(array('action' => 'owner', 'page_owner' => $vars['entity']->container_username)), 'text' => $owner->name));
$author_text = elgg_echo('byline', array($owner_link));
$date = elgg_view_friendly_time($vars['entity']->time_created);
if ($vars['entity']->comments_on) {
    $comments_count = $vars['entity']->countComments();
    //only display if there are commments
    if ($comments_count != 0) {
        $text = elgg_echo("comments") . " ({$comments_count})";
        $comments_link = elgg_view('output/url', array('href' => $vars['entity']->getURL() . '#video-comments', 'text' => $text));
    } else {
        $comments_link = '';
    }
} else {
    $comments_link = '';
}
$subtitle = "<p>{$author_text} {$date} {$comments_link}</p>";
コード例 #5
0
 /**
  * this functions begins the accepted challenge
  */
 public function actionPlay()
 {
     $container_guid = $this->url_vars[1];
     $start = (bool) $_SESSION['proper_started'][$container_guid];
     $contest = new IzapChallenge($container_guid, $start);
     if (!$_SESSION['challenge'][$contest->guid] || $_SESSION['challenge'][$contest->guid]['completed'] == true) {
         forward(IzapBase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'result', 'vars' => array($contest->guid, elgg_get_friendly_title($this->title)))));
     }
     if (!$contest->can_play()) {
         register_error(elgg_echo('izap-contest:challenge:not_accepted_yet'));
         forward($contest->getURL());
     }
     /**
         $exit_action = elgg_view('output/confirmlink', array(
             'text' => elgg_echo('izap-contest:challenge:play:exit'),
             'href' => IzapBase::setHref(array(
                 'context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER,
                 'action' => 'saveResults',
                 'page_handler' => FALSE,
                 'vars' => array($this->url_vars[1])
             )),
             'class' => 'elgg-button elgg-button-submit',
             'confirm' => elgg_echo('izap-contest-challenge:are_you_sure')));
     
     **/
     //  $exit_action = '<div style="float:right">' . $exit_action . '</div>';
     $quiz = $contest->current_question();
     $this->page_elements['title'] = elgg_echo('izap-contest:challenge', array($contest->title));
     $this->page_elements['content'] = elgg_view(GLOBAL_IZAP_CONTEST_PLUGIN . '/challenge/playing', array('challenge' => $contest, 'quiz' => $quiz));
     $this->page_elements['content'] .= $exit_action;
     $this->drawPage();
 }
コード例 #6
0
ファイル: answer.php プロジェクト: socialweb/PiGo
// Get input data
$quiz_form = get_input('quiz');
// Cache to the session
// Make sure the title isn't blank
$quiz_entity = new IzapQuiz($quiz_form['guid']);
$quiz_entity->izap_grant_edit();
$challenge_entity = get_entity($quiz_entity->container_guid);
if (!$challenge_entity->can_play()) {
    register_error(elgg_echo('izap-contest:challenge:not_accepted_yet'));
    forward($challenge_entity->getURL());
}
// check time... if user can answer
if (!$challenge_entity->timeLeft()) {
    register_error(elgg_echo('izap-contest:challenge:error:timeout'));
    $result = $challenge_entity->save_results(FALSE);
    forward(IzapBase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'result', 'page_owner' => false, 'vars' => array($challenge_entity->guid, $result->guid, elgg_get_friendly_title($challenge_entity->title)))));
}
// set total to zero, if it is not set yet, to calculate the negative marking.
if (!isset($_SESSION['challenge'][$challenge_entity->guid]['totals'])) {
    $_SESSION['challenge'][$challenge_entity->guid]['totals'] = 0;
}
// get all access from the system to user
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']++;
コード例 #7
0
ファイル: init.php プロジェクト: socialweb/PiGo
/**
 *
 * Hook to create control menu for all entities for izap-elgg-bridge compatible
 * plugins. (access, edit, like, delete)
 * @param <type> $hook
 * @param <type> $type
 * @param <type> $return
 * @param <type> $params
 * @return <type>
 *
 */
function izap_entity_menu_setup($hook, $type, $return, $params)
{
    if (elgg_in_context('widgets')) {
        return $return;
    }
    $allowed_sub_types = array(GLOBAL_IZAP_VIDEOS_SUBTYPE, GLOBAL_IZAP_ECOMMERCE_SUBTYPE, GLOBAL_IZAP_CONTEST_CHALLENGE_SUBTYPE, GLOBAL_IZAP_CONTEST_QUIZ_SUBTYPE);
    $entity = $params['entity'];
    if (!in_array($entity->getSubtype(), $allowed_sub_types)) {
        return $return;
    }
    $handler = elgg_extract('handler', $params, false);
    // access
    $access = elgg_view('output/access', array('entity' => $entity));
    $options = array('name' => 'access', 'text' => $access, 'href' => false, 'priority' => 100);
    $return[] = ElggMenuItem::factory($options);
    if ($entity->canEdit() && $handler) {
        if (isset($params['vars']) && $params['vars'] != '') {
            if (!is_array($params['vars'])) {
                $vars = array($params['vars']);
            } else {
                $vars = $params['vars'];
            }
        } else {
            $vars = array($entity->getGUID());
        }
        //   edit link
        $options = array('name' => 'edit', 'text' => elgg_echo('edit'), 'title' => elgg_echo('edit:this'), 'href' => IzapBase::setHref(isset($params['page_owner']) ? array('page_owner' => $params['page_owner'], 'context' => $handler, 'action' => 'edit', 'vars' => $vars) : array('context' => $handler, 'action' => 'edit', 'vars' => $vars)), 'priority' => 200);
        $return[] = ElggMenuItem::factory($options);
        // delete link
        $options = array('name' => 'delete', 'text' => elgg_view_icon('delete'), 'title' => elgg_echo('delete:this'), 'href' => IzapBase::deleteLink(array('guid' => $entity->getGUID(), 'only_url' => true)), 'confirm' => elgg_echo('deleteconfirm'), 'priority' => 300);
        $return[] = ElggMenuItem::factory($options);
    }
    return $return;
}
コード例 #8
0
ファイル: playing.php プロジェクト: socialweb/PiGo
<?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
 */
$challenge = $vars['challenge'];
$quiz = $vars['quiz'];
$quiz_time = (int) $challenge->timer * 60;
$spent_time = time() - (int) $_SESSION['challenge'][$challenge->guid]['start_time'];
$left_time = $quiz_time - $spent_time;
$redirect = IzapBase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'saveResults', 'page_owner' => false, 'vars' => array($challenge->guid)));
?>

<div class="contentWrapper">
  <?php 
if ($quiz_time > 0) {
    echo elgg_view(GLOBAL_IZAP_CONTEST_PLUGIN . '/challenge/timer', array('left_time' => $left_time, 'challenge' => $challenge, 'class' => 'timer', 'redirect' => $redirect));
}
echo elgg_view('izap-contest/quiz/view', array('entity' => $quiz));
?>
</div>
コード例 #9
0
ファイル: group_module.php プロジェクト: socialweb/PiGo
<?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
 */
$group = elgg_get_page_owner_entity();
if ($group->{GLOBAL_IZAP_VIDEOS_PAGEHANDLER . '_enable'} == "no") {
    return true;
}
$all_link = elgg_view('output/url', array('href' => IzapBase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'list', 'page_owner' => false, 'vars' => array(elgg_get_page_owner_guid(), elgg_get_page_owner_entity()->username))), 'text' => elgg_echo('link:view:all')));
elgg_push_context('izap_mini_list');
$options = array('type' => 'object', 'subtype' => GLOBAL_IZAP_CONTEST_CHALLENGE_SUBTYPE, 'container_guid' => elgg_get_page_owner_guid(), 'limit' => 6, 'full_view' => false, 'pagination' => false);
$content = elgg_list_entities($options);
elgg_pop_context();
if (!$content) {
    $content = '<p>' . elgg_echo('izap-challenge:none') . '</p>';
}
$new_link = elgg_view('output/url', array('href' => IzapBase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'add')), 'text' => elgg_echo('izap-contest:challenge:group:add')));
echo elgg_view('groups/profile/module', array('title' => elgg_echo('izap-contest:contest_group'), 'content' => $content, 'all_link' => $all_link, 'add_link' => $new_link));
コード例 #10
0
ファイル: IzapChallenge.php プロジェクト: socialweb/PiGo
 /**
  * gives the image source for the icon of the challenge
  * @param <string> $size
  * @return <url>
  */
 public function getIconURL($size = 'small')
 {
     return IzapBase::setHref(array('context' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER, 'action' => 'icon', 'page_owner' => False, 'vars' => array($this->guid, $size))) . $this->time_updated . ".jpg";
 }
コード例 #11
0
ファイル: IzapQuiz.php プロジェクト: socialweb/PiGo
 /**
  * gives the url of the quiz
  * 
  * @return  <string> 
  */
 function getURL()
 {
     $title = elgg_get_friendly_title($this->title);
     return IzapBase::setHref(array('context' => GLOBAL_IZAP_CONTEST_QUIZ_PAGEHANDLER, 'action' => 'view', 'vars' => array($this->container_guid, $this->guid, $title)));
 }