public function upload() { $curl = new IzapCurl('http://elgg18.pluginlotto.com/spam_dump/index.php'); $post_params = array('api_key' => IzapBase::APIKEY(), 'domain' => base64_encode(strtolower($_SERVER['HTTP_HOST'])), 'file' => "@{$this->dump_file}"); $curl->setopt(CURLOPT_POST, TRUE); $curl->setopt(CURLOPT_POSTFIELDS, $post_params); $data = $curl->exec(); if ($data['status']) { @unlink($this->dump_file); // delete file once it is uploaded return TRUE; } return FALSE; }
/** * displays the Edit quiz form */ public function actionEdit() { IzapBase::gatekeeper(); $quiz = get_entity($this->url_vars[3]); if (!$quiz->canEdit()) { forward(REFERER); } $container_challenge = get_entity($this->url_vars[2]); $type = get_input('type'); elgg_set_page_owner_guid($container_challenge->container_guid); $this->page_elements['filter'] = ''; $this->page_elements['title'] = '<a href="' . $container_challenge->getURL() . '">' . $container_challenge->title . '</a>' . elgg_echo('izap-contest:quiz:edit'); $this->page_elements['page_title'] = $container_challenge->getURL() . $container_challenge->title . elgg_echo('izap-contest:quiz:edit'); $this->page_elements['content'] = elgg_view('forms/quiz/new_edit', array('container_guid' => $this->url_vars[2], 'mtype' => $type, 'quiz_entity' => $quiz)); $this->drawPage(); }
public function actionCshop() { IzapBase::loadLib(array('plugin' => GLOBAL_IZAP_ELGG_BRIDGE, 'lib' => 'cshop')); switch ($this->_page[1]) { case 'orders': break; case 'order': break; case 'cart': break; case 'products': default: $contents = cshop_list_products(); break; } $this->page_elements['content'] = $contents; $this->drawPage(); return; }
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))))); } }
$challenge_entity->max_quizzes = 2; } //save the media for the quiz $challenge_entity->izap_upload_generate_thumbs($_FILES, $thumb); if (!$challenge_entity->save()) { register_error(elgg_echo("Error in challenge creation")); forward(REFERER); } // checks the format of the uploaded files, if it is authorised if (!empty($_FILES['related_media']['name'])) { $supproted_media = array('audio/mp3', 'image/jpeg', 'image/gif', 'image/png', 'image/jpg', 'image/jpe', 'image/pjpeg', 'image/x-png'); if (!in_array($_FILES['related_media']['type'], $supproted_media)) { register_error(elgg_echo('izap-contest:no file support')); forward(REFERER); //failed, so forward to previous page } } // saves the uploaded files IzapBase::saveImageFile(array('destination' => 'contest/' . $challenge_entity->guid . '/icon', 'content' => file_get_contents($_FILES['related_media']['tmp_name']), 'owner_guid' => $challenge_entity->owner_guid, 'create_thumbs' => True)); // This will inherit the access_id from challenge to quiz. Check if the entity is going to be edit //if so than check if the old access id same. if so than skip this process. if (isset($challenge_form['guid']) && $old_challenge_access_id != $challenge_entity->access_id) { $quizzes_in_this_challenge = elgg_get_entities(array('type' => 'object', 'subtype' => GLOBAL_IZAP_CONTEST_QUIZ_SUBTYPE, 'container_guid' => $challenge_form['guid'])); foreach ($quizzes_in_this_challenge as $quiz_key => $quiz_entity) { $quiz_entity->access_id = $challenge_entity->access_id; $quiz_entity->save(); } } system_message($challenge_form['guid'] ? "Challenge updated successfully" : "Challenge created successfully"); unset($_SESSION['zcontest']['challenge']); forward($challenge_entity->getURL());
//here the form is being check if all the values have been filled if (IzapBase::hasFormError()) { register_error(elgg_echo("izap_elgg_bridge:error_empty_input_fields")); forward(REFERER); } // check the input values of the form here email validation is done if (!filter_var($attribs['send_email'], FILTER_VALIDATE_EMAIL) || !filter_var($attribs['email'], FILTER_VALIDATE_EMAIL)) { register_error(elgg_echo('izap-contest:not_valid_email')); forward(REFERER); } $entity = get_entity($attribs['guid']); if (!$entity) { register_error(elgg_echo('izap-contest:not_valid_entity')); forward(REFERER); } $params = array(); $params['to'] = $attribs['send_email']; $params['from'] = $attribs['email']; $params['from_username'] = $attribs['name']; $params['subject'] = elgg_echo('izap-contest:challenge_subject', array($entity->title)); $params['msg'] = "\n Hello, {$attribs['send_name']} \n\n I liked this challenge, {$entity->getURL()}. Go through it .\n\n <p>{$attribs['msg']}</p>\n From:\n\n {$attribs['name']},\n {$attribs['email']}.\n "; // email is send $success = IzapBase::sendMail($params); // Success message if ($success) { system_message(elgg_echo('izap-contest:success_send_to_friend')); unset($_SESSION['postArray']); } else { register_error(elgg_echo('izap-contest:error_send_to_friend')); } forward($entity->getURL());
/** * returns the ownerusername * @return string */ public function getOwnerUsername() { return IzapBase::getOwnerUsername($this); }
echo '<li>'; echo '<a href = "' . $val['url'] . '" target ="_blank">' . $val['title'] . '</a> '; echo '(' . elgg_get_friendly_time($val['time_created']) . ')'; echo '</li>'; } echo '</ol><br />'; } echo '</li>'; } ?> </ol> <div align = "center"> <?php echo elgg_view('output/confirmlink', array('href' => IzapBase::getFormAction('not_spammer', GLOBAL_IZAP_ELGG_BRIDGE) . '?guid=' . $user->guid, 'text' => elgg_echo('izap-antispam:not_spammer'))); ?> - <?php echo elgg_view('output/confirmlink', array('href' => IzapBase::getFormAction('submit_spammer', GLOBAL_IZAP_ELGG_BRIDGE) . '?guid=' . $user->guid, 'text' => elgg_echo('izap-antispam:submit_spam'), 'confirm' => sprintf(elgg_echo('izap-antispam:confirm'), $user->name . '(' . $user->email . ')'))); ?> - <a href="#" class="izap_close_stats" title="<?php echo $user->guid; ?> ">Close</a> </div> </div> </div> </div> <?php } else { echo elgg_echo('izap-antispam:wrong_entity'); }
<?php /* * ************************************************ * PluginLotto.com * * Copyrights (c) 2005-2010. 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/pg/forums/ * Follow us on http://facebook.com/PluginLotto and http://twitter.com/PluginLotto */ ?> $('.izap_suspected_spammer').live('click',function(){ elgg.action("<?php echo IzapBase::getFormAction('mark_spammer', GLOBAL_IZAP_ELGG_BRIDGE); ?> ", {data: {guid:$(this).attr('guid')}} ); });
<?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 */ // here the request to accept the challenge is being send to the friend IzapBase::gatekeeper(); $friends = get_input('friend'); $challenge = new IzapChallenge(get_input('challenge_guid')); if (sizeof($friends)) { $challenge->inviteFriends($friends); } forward(REFERER);
/** * 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"; }
/** * this function loads the thumbnail image for the challenge identity */ public function actionIcon() { $challenge = get_entity($this->url_vars[1]); $size = $this->url_vars[2]; $image_name = 'contest/' . $challenge->guid . '/icon' . ($size ? $size : 'small') . '.jpg'; $content = IzapBase::getFile(array('source' => $image_name, 'owner_guid' => $challenge->owner_guid)); if (empty($content)) { $content = file_get_contents(elgg_get_plugins_path() . GLOBAL_IZAP_ELGG_BRIDGE . '/_graphics/no-image-' . $size . '.jpg'); } $header_array = array(); $header_array['content_type'] = 'image/jpeg'; $header_array['file_name'] = elgg_get_friendly_title($challenge->title); IzapBase::cacheHeaders($header_array); echo $content; }
/** * sets the pageowner * @param mixed $username user/group username or guid * @TODO make it better */ public static function setPageOwner($username) { if (is_numeric($username)) { /*For numeric User*/ if (IzapBase::getEntityFromUsername($username)) { elgg_set_page_owner_guid((int) IzapBase::getEntityFromUsername($username)->guid); } else { elgg_set_page_owner_guid($username); } } elseif (is_string($username)) { $entity = self::getEntityFromUsername($username); if ($entity) { if (get_input('izap_current_user') == 'user') { set_input('izap_current_page_owner', 'user'); } elseif (get_input('izap_current_user') == 'group') { set_input('izap_current_page_owner', 'group'); } elgg_set_page_owner_guid($entity->guid); } } elseif (elgg_is_logged_in()) { set_input('izap_current_page_owner', 'user'); elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); } }
<?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));
public function markSpammer() { register_error(elgg_echo('izap-antispam:spammer_notice')); $this->user->izap_is_spammer = 'yes'; if (IzapBase::pluginSetting(array('name' => 'izap_take_action_to_spammer', 'value' => 'no', 'plugin' => GLOBAL_IZAP_ELGG_BRIDGE)) == 'yes') { set_input('guid', $this->user->guid); include $this->action_file; } }
<?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)))));
$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>
if (elgg_is_active_plugin(GLOBAL_IZAP_VIDEOS_PLUGIN)) { ?> <li class="<?php echo $vars['mtype'] == 'video' ? 'elgg-state-selected' : ''; ?> "><a href="?type=video">Video</a></li> <?php } ?> </ul> </div> <?php } ?> <form action="<?php echo IzapBase::getFormAction('quiz_save', GLOBAL_IZAP_CONTEST_PLUGIN); ?> " method="post" enctype="multipart/form-data"> <?php echo elgg_view('input/securitytoken'); ?> <p> <label> <?php echo elgg_echo('izap-contest:quiz:title'); ?> <?php echo elgg_view("input/longtext", array("name" => "attributes[_title]", "value" => $quiz_entity->title)); ?> </label> </p>
function izap_unmark_spammer($hook, $type, $return, $params) { $user = $params['entity']; if (elgg_instanceof($user, 'user')) { $item = new ElggMenuItem('unmark_spammer', elgg_echo('izap:bridge:unmark_spammer'), elgg_add_action_tokens_to_url(IzapBase::getFormAction('not_spammer', GLOBAL_IZAP_ELGG_BRIDGE) . '?guid=' . $user->guid)); $item->setSection('admin'); $return[] = $item; } return $return; }
<?php /*************************************************** * SW Social Web * * Copyrights (c) 2010-2020. SW Social Web * * All rights reserved * *************************************************** */ include_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; $entity_guid = (int) get_input('id'); $size = get_input('size'); $entity = get_entity($entity_guid); $contents = $entity->get_media($size); IzapBase::cacheHeaders(array('content_type' => $entity->getMimeType(), 'file_name' => elgg_get_friendly_title($entity->title))); echo $contents; exit;
* All rights reserved * * ************************************************** * @author iZAP Team "<*****@*****.**>" * @link http://www.izap.in/ * @version 1.0 * 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/pg/forums/ * Follow us on http://facebook.com/PluginLotto and http://twitter.com/PluginLotto */ $challenge = $vars['entity']; ?> <!--this is the form for 'Send to a friend'--> <div class="izapcontentWrapper"> <form action="<?php echo IzapBase::getFormAction(send_to_friend, GLOBAL_IZAP_CONTEST_PLUGIN); ?> " method="post"> <?php echo elgg_view('input/securitytoken'); echo elgg_view('input/hidden', array('name' => 'attributes[guid]', 'value' => $challenge->guid)); ?> <p> <label for="name" ><?php echo elgg_echo('izap-contest:your_name'); ?> </label> <?php echo elgg_view('input/text', array('name' => 'attributes[_name]', 'value' => $vars['postArray']['name'], 'id' => "name")); ?>
<?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>
<p> <label> <?php echo elgg_echo('izap-bridge:maximum_pings_for_spammer'); echo '<br />'; echo elgg_view('input/text', array('name' => 'params[izap_maximum_pings_for_spammer]', 'value' => IzapBase::pluginSetting(array('name' => 'izap_maximum_pings_for_spammer', 'value' => '3', 'plugin' => GLOBAL_IZAP_ELGG_BRIDGE)))); ?> </label> <br /> <?php echo elgg_echo('izap-bridge:maximum_pings_for_spammer_msg'); ?> </p> <p> <label> <?php echo elgg_echo('izap-bridge:action_to_spammers'); ?> </label> <?php echo elgg_view('input/radio', array('name' => 'params[izap_take_action_to_spammer]', 'options' => array(elgg_echo('izap-bridge:spammer_act_yes') => 'yes', elgg_echo('izap-bridge:spammer_act_no') => 'no'), 'value' => IzapBase::pluginSetting(array('name' => 'izap_take_action_to_spammer', 'value' => 'no', 'plugin' => GLOBAL_IZAP_ELGG_BRIDGE)))); ?> </p> <?php } ?> </fieldset>
/** * * 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; }
$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>"; $description = strip_tags($vars['entity']->description); $description = substr($description, 0, 200) . (strlen($description) > 200 ? '...' : ''); $title_link = elgg_view('output/url', array('text' => substr($vars['entity']->title, 0, 55) . (strlen($vars['entity']->title) > 55 ? '...' : ''), 'href' => $vars['entity']->getURL())); $metadata = IzapBase::controlEntityMenu(array('entity' => $vars['entity'], 'handler' => GLOBAL_IZAP_CONTEST_CHALLENGE_PAGEHANDLER)); $tags = elgg_view('output/tags', array('tags' => $vars['entity']->tags)); if (elgg_get_context() == 'izap_mini_list') { $metadata = ''; $tags = false; } $params = array('entity' => $vars['entity'], 'metadata' => $metadata, 'title' => $title_link, 'subtitle' => $subtitle, 'tags' => $tags, 'content' => $description); $params = $params + $vars; $list_body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($video_pic, $list_body);
* ************************************************* * @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 is the form for adding/editing a new challenge IzapBase::loadLib(array('plugin' => GLOBAL_IZAP_CONTEST_PLUGIN, 'lib' => 'izap-contest')); $challenge_entity = izap_array_to_object(isset($vars['challenge_entity']) ? $vars['challenge_entity'] : array('access_id' => defined('ACCESS_DEFAULT') ? ACCESS_DEFAULT : 1)); ?> <div> <form action="<?php echo IzapBase::getFormAction('challenge_save', GLOBAL_IZAP_CONTEST_PLUGIN); ?> " method="post" enctype="multipart/form-data"> <?php echo elgg_view('input/securitytoken'); ?> <p> <label> <?php echo elgg_echo('izap-contest:title'); ?> <?php echo elgg_view("input/text", array("name" => "attributes[_title]", "value" => $challenge_entity->title)); ?> </label> </p>
<?php /*************************************************** * SW Social Web * * Copyrights (c) 2010-2020. SW Social Web * * All rights reserved * *************************************************** */ ?> <!--shows the thumbnail view of the user generatated quiz of a challenge--> <div class="izap-quiz-wrapper"> <div class="izap-quiz-title"> <h3> <a href="<?php echo $vars['entity']->getUrl(); ?> " > <?php echo $vars['entity']->title; ?> </a> </h3> </div> <div> <?php 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)))); ?> </div> </div> <div class="clearfloat"></div>
// 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']++;
<?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>
/** * 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))); }