/**
  * Displays the 'tagcloud' display type
  *
  * @param stdClass|C_Displayed_Gallery|C_DataMapper_Model $displayed_gallery
  */
 function index_action($displayed_gallery, $return = FALSE)
 {
     $display_settings = $displayed_gallery->display_settings;
     $application = $this->object->get_registry()->get_utility('I_Router')->get_routed_app();
     $tag = $this->param('gallerytag');
     // we're looking at a tag, so show images w/that tag as a thumbnail gallery
     if (!is_home() && !empty($tag)) {
         return $this->object->get_registry()->get_utility('I_Displayed_Gallery_Renderer')->display_images(array('source' => 'tags', 'container_ids' => array(esc_attr($tag)), 'display_type' => $display_settings['display_type'], 'original_display_type' => $displayed_gallery->display_type, 'original_settings' => $display_settings));
     }
     $defaults = array('exclude' => '', 'format' => 'list', 'include' => $displayed_gallery->get_term_ids_for_tags(), 'largest' => 22, 'link' => 'view', 'number' => $display_settings['number'], 'order' => 'ASC', 'orderby' => 'name', 'smallest' => 8, 'taxonomy' => 'ngg_tag', 'unit' => 'pt');
     $args = wp_parse_args('', $defaults);
     // Always query top tags
     $tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
     foreach ($tags as $key => $tag) {
         $tags[$key]->link = $this->object->set_param_for($application->get_routed_url(TRUE), 'gallerytag', $tag->slug);
         $tags[$key]->id = $tag->term_id;
     }
     $params = $display_settings;
     $params['inner_content'] = $displayed_gallery->inner_content;
     $params['storage'] =& $storage;
     $params['tagcloud'] = wp_generate_tag_cloud($tags, $args);
     $params['displayed_gallery_id'] = $displayed_gallery->id();
     $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
     return $this->object->render_partial('photocrati-nextgen_basic_tagcloud#nextgen_basic_tagcloud', $params, $return);
 }
Пример #2
0
 /**
  * Get the services
  *
  * @return \SeBuDesign\Buckaroo\Soap\Types\Responses\TransactionRequestSpecification\Services
  */
 public function getServices()
 {
     $mServiceDescriptions = $this->Services->ServiceDescription;
     $this->Services = new Services();
     $this->Services->setServiceDescriptions($mServiceDescriptions);
     return $this->Services;
 }
 public function searchByName($company_name)
 {
     $params = new stdClass();
     $params->externalNameSearch($company_name);
     $params->authenticationGuid = $this->guid;
     return $this->ABRSearchByName($params);
 }
Пример #4
0
 /**
  * Triggered via the user_loggedin event, when a user logs in.
  *
  * @param stdClass $event
  */
 public static function user_loggedin($event)
 {
     global $DB;
     $eventdata = $event->get_data();
     if (!enrol_is_enabled('auto')) {
         return;
     }
     if (is_siteadmin($eventdata['userid'])) {
         // Don't enrol site admins
         return;
     }
     // Get all courses that have an auto enrol plugin, set to auto enrol on login, where the user isn't enrolled yet
     $sql = "SELECT e.courseid\n            FROM {enrol} e\n            LEFT JOIN {user_enrolments} ue ON e.id = ue.enrolid AND ue.userid = ?\n            WHERE e.enrol = 'auto'\n            AND e.status = ?\n            AND e.customint3 = ?\n            AND ue.id IS NULL";
     if (!($courses = $DB->get_records_sql($sql, array($eventdata['userid'], ENROL_INSTANCE_ENABLED, ENROL_AUTO_LOGIN)))) {
         return;
     }
     $autoplugin = enrol_get_plugin('auto');
     foreach ($courses as $course) {
         if (!($instance = $autoplugin->get_instance_for_course($course->courseid))) {
             continue;
         }
         $autoplugin->enrol_user($instance, $eventdata['userid'], $instance->roleid);
         // Send welcome message.
         if ($instance->customint2) {
             $autoplugin = enrol_get_plugin('auto');
             $autoplugin->email_welcome_message($instance, $DB->get_record('user', array('id' => $eventdata['userid'])));
         }
     }
 }
Пример #5
0
 /**
  * Prepares component
  *
  * @param stdClass $database
  */
 public static function setup($database)
 {
     if (!isset($database->adapter)) {
         throw new \Phalcon\Exception('Unspecified database Adapter in your configuration!');
     }
     $adapter = '\\Phalcon\\Db\\Adapter\\Pdo\\' . $database->adapter;
     if (!class_exists($adapter)) {
         throw new \Phalcon\Exception('Invalid database Adapter!');
     }
     $configArray = $database->toArray();
     unset($configArray['adapter']);
     self::$_connection = new $adapter($configArray);
     self::$_databaseConfig = $database;
     $profiler = new Profiler();
     $eventsManager = new EventsManager();
     $eventsManager->attach('db', function ($event, $connection) use($profiler) {
         if ($event->getType() == 'beforeQuery') {
             $profiler->startProfile($connection->getSQLStatement());
         }
         if ($event->getType() == 'afterQuery') {
             $profiler->stopProfile();
         }
     });
     self::$_connection->setEventsManager($eventsManager);
 }
 /**
  * Render the templates
  *
  * @param \Nette\Forms\Form $form
  * @param string $mode
  *
  * @return void
  */
 public function render(Nette\Forms\Form $form, $mode = NULL)
 {
     if ($this->form !== $form) {
         $this->form = $form;
         // translators
         if ($translator = $this->form->getTranslator()) {
             $this->template->setTranslator($translator);
         }
         // controls placeholders & classes
         foreach ($this->form->getControls() as $control) {
             $this->prepareControl($control);
         }
         $formEl = $form->getElementPrototype();
         if (!$formEl->class || stripos('form-', (string) $formEl->class) === FALSE) {
             $formEl->addClass('form-horizontal');
         }
     }
     $this->template->form = $this->form;
     $this->template->_form = $this->form;
     $this->template->renderer = $this;
     if ($mode === NULL) {
         $this->template->render();
     } elseif ($mode === 'begin') {
         FormMacros::renderFormBegin($this->form, array());
     } elseif ($mode === 'end') {
         FormMacros::renderFormEnd($this->form);
     } else {
         $this->template->setFile(__DIR__ . '/@parts.latte');
         $this->template->mode = $mode;
         $this->template->render();
         $this->template->setFile(__DIR__ . '/@form.latte');
     }
 }
 /**
  * Displays the ngglegacy thumbnail gallery.
  * This method deprecates the use of the nggShowGallery() function.
  * @param stdClass|C_Displayed_Gallery|C_DataMapper_Model $displayed_gallery
  */
 function index_action($displayed_gallery, $return = FALSE)
 {
     // Get the images to be displayed
     $current_page = (int) $this->param('nggpage', 1);
     if ($images = $displayed_gallery->get_included_entities()) {
         // Get the gallery storage component
         $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
         // Create parameter list for the view
         $params = $displayed_gallery->display_settings;
         $params['storage'] =& $storage;
         $params['images'] =& $images;
         $params['displayed_gallery_id'] = $displayed_gallery->id();
         $params['current_page'] = $current_page;
         $params['effect_code'] = $this->object->get_effect_code($displayed_gallery);
         $params['anchor'] = 'ngg-slideshow-' . $displayed_gallery->id() . '-' . rand(1, getrandmax()) . $current_page;
         $gallery_width = $displayed_gallery->display_settings['gallery_width'];
         $gallery_height = $displayed_gallery->display_settings['gallery_height'];
         $params['aspect_ratio'] = $gallery_width / $gallery_height;
         $params['placeholder'] = $this->object->get_static_url('photocrati-nextgen_basic_gallery#slideshow/placeholder.gif');
         // Are we to generate a thumbnail link?
         if ($displayed_gallery->display_settings['show_thumbnail_link']) {
             $params['thumbnail_link'] = $this->object->get_url_for_alternate_display_type($displayed_gallery, NGG_BASIC_THUMBNAILS);
         }
         $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
         $retval = $this->object->render_partial('photocrati-nextgen_basic_gallery#slideshow/index', $params, $return);
     } else {
         $retval = $this->object->render_partial('photocrati-nextgen_gallery_display#no_images_found', array(), $return);
     }
     return $retval;
 }
Пример #8
0
 /**
  * @param \stdClass $object
  */
 function it_wraps_non_token_arguments_into_ExactValueToken($object)
 {
     $this->beConstructedWith(array(42, 'zet', $object));
     $class = get_class($object->getWrappedObject());
     $hash = spl_object_hash($object->getWrappedObject());
     $this->__toString()->shouldReturn("exact(42), exact(\"zet\"), exact({$class}:{$hash} Object (\n    'objectProphecy' => Prophecy\\Prophecy\\ObjectProphecy Object (*Prophecy*)\n))");
 }
Пример #9
0
 /**
  * @internal
  * @param IQuery|stdClass $query
  * @return string
  * @internal
  */
 public function getStorageId($query)
 {
     if ($query instanceof IVoidQuery) {
         return $query->getStorageType() . '|' . $query->getDatabaseName();
     }
     // else is aggregation, stdClass
     return $query->storageType . '|' . $query->databaseName;
 }
Пример #10
0
 /**
  * Generate a link to an user profile of a social platform.
  *
  * <code>
  * $avatar  = JHtml::_("userideas.profile", $socialProfiles, $userId, "javascript: void(0);");
  * </code>
  *
  * @param stdClass  $socialProfiles Social profiles object.
  * @param integer $userId         User ID
  * @param string  $default        A link to default profile.
  *
  * @return string
  */
 public static function profile($socialProfiles, $userId, $default = null)
 {
     $link = !$socialProfiles ? null : $socialProfiles->getLink($userId);
     // Set the link to default picture
     if (!$link and $default !== null) {
         $link = $default;
     }
     return $link;
 }
 /**
  * Render the templates.
  * @param Form    $form
  * @param string  $mode
  * @param array   $args
  */
 public function render(Form $form, $mode = NULL, $args = NULL)
 {
     if ($this->template === NULL) {
         if ($presenter = $form->lookup('Nette\\Application\\UI\\Presenter', FALSE)) {
             /** @var \Nette\Application\UI\Presenter $presenter */
             $this->template = clone $presenter->getTemplate();
         } else {
             $this->template = new FileTemplate();
             $this->template->registerFilter(new \Nette\Latte\Engine());
         }
     }
     if ($this->form !== $form) {
         $this->form = $form;
         // translators
         if ($translator = $this->form->getTranslator()) {
             $this->template->setTranslator($translator);
         }
         // controls placeholders & classes
         foreach ($this->form->getControls() as $control) {
             $this->prepareControl($control);
         }
         $formEl = $form->getElementPrototype();
         if (!($classes = self::getClasses($formEl)) || stripos($classes, 'form-') === FALSE) {
             //$formEl->addClass('form-horizontal');
         }
     } elseif ($mode === 'begin') {
         foreach ($this->form->getControls() as $control) {
             /** @var \Nette\Forms\Controls\BaseControl $control */
             $control->setOption('rendered', FALSE);
         }
     }
     $this->template->setFile(__DIR__ . '/@form.latte');
     $this->template->setParameters(array_fill_keys(array('control', '_control', 'presenter', '_presenter'), NULL) + array('_form' => $this->form, 'form' => $this->form, 'renderer' => $this));
     if ($mode === NULL) {
         if ($args) {
             $this->form->getElementPrototype()->addAttributes($args);
         }
         $this->template->render();
     } elseif ($mode === 'begin') {
         FormMacros::renderFormBegin($this->form, (array) $args);
     } elseif ($mode === 'end') {
         FormMacros::renderFormEnd($this->form);
     } else {
         $attrs = array('input' => array(), 'label' => array());
         foreach ((array) $args as $key => $val) {
             if (stripos($key, 'input-') === 0) {
                 $attrs['input'][substr($key, 6)] = $val;
             } elseif (stripos($key, 'label-') === 0) {
                 $attrs['label'][substr($key, 6)] = $val;
             }
         }
         $this->template->setFile(__DIR__ . '/@parts.latte');
         $this->template->mode = $mode;
         $this->template->attrs = (array) $attrs;
         $this->template->render();
     }
 }
Пример #12
0
 /**
  * Stores Plugin params to the DB. Used after setting new param values.
  * @param stdClass $params the Joomla params object.  
  * Typically you would send $this->params from the plugin class to this method, 
  * after setting new values with $this->params->set('param_name', $value);
  * @param string $element The plugin element in small caps without 
  * plgSystem, for example the plugin plgSystemAutofbook would be autofbook. 
  * Check the db for correct name
  */
 public static function storeParams($params, $element)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->update('#__extensions');
     $query->set('params = ' . $db->quote($params->toString()));
     $query->where('element = ' . $db->quote($element));
     $db->setQuery($query);
     $db->query();
 }
Пример #13
0
 /**
  * @param PayPal $payPal
  * @param Session $session
  */
 public function __construct(PayPal $payPal, Session $session)
 {
     parent::__construct();
     $this->payPal = $payPal;
     $this->session = $session->getSection('PayPalExpress');
     $this->session->setExpiration('+10 minutes');
     if (empty($this->session->token)) {
         $this->session->token = $this->_ec = Strings::random(6);
     }
 }
/**
 * Form for editing Information Spot  block instances.
 *
 * @copyright 2014 Roberto Pinna
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @package   block_informationspot
 * @category  files
 * @param stdClass $course course object
 * @param stdClass $birecord_or_cm block instance record
 * @param stdClass $context context object
 * @param string $filearea file area
 * @param array $args extra arguments
 * @param bool $forcedownload whether or not force download
 * @param array $options additional options affecting the file serving
 * @return bool
 */
function block_informationspot_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload, array $options = array())
{
    global $DB, $CFG, $USER;
    if ($context->contextlevel != CONTEXT_BLOCK) {
        send_file_not_found();
    }
    // If block is in course context, then check if user has capability to access course.
    if ($context->get_course_context(false)) {
        require_course_login($course);
    } else {
        if ($CFG->forcelogin) {
            require_login();
        } else {
            // Get parent context and see if user have proper permission.
            $parentcontext = $context->get_parent_context();
            if ($parentcontext->contextlevel === CONTEXT_COURSECAT) {
                // Check if category is visible and user can view this category.
                $category = $DB->get_record('course_categories', array('id' => $parentcontext->instanceid), '*', MUST_EXIST);
                if (!$category->visible) {
                    require_capability('moodle/category:viewhiddencategories', $parentcontext);
                }
            } else {
                if ($parentcontext->contextlevel === CONTEXT_USER && $parentcontext->instanceid != $USER->id) {
                    // The block is in the context of a user, it is only visible to the user who it belongs to.
                    send_file_not_found();
                }
            }
            // At this point there is no way to check SYSTEM context, so ignoring it.
        }
    }
    if ($filearea != 'image') {
        send_file_not_found();
    }
    $fs = get_file_storage();
    $imageid = array_shift($args);
    $filename = array_pop($args);
    $filepath = $args ? '/' . implode('/', $args) . '/' : '/';
    if (!($file = $fs->get_file($context->id, 'block_informationspot', $filearea, $imageid, $filepath, $filename)) or $file->is_directory()) {
        send_file_not_found();
    }
    if ($parentcontext = context::instance_by_id($birecord_or_cm->parentcontextid, IGNORE_MISSING)) {
        if ($parentcontext->contextlevel == CONTEXT_USER) {
            // force download on all personal pages including /my/
            //because we do not have reliable way to find out from where this is used
            $forcedownload = true;
        }
    } else {
        // weird, there should be parent context, better force dowload then
        $forcedownload = true;
    }
    // NOTE: it woudl be nice to have file revisions here, for now rely on standard file lifetime,
    //       do not lower it because the files are dispalyed very often.
    \core\session\manager::write_close();
    send_stored_file($file, null, 0, $forcedownload, $options);
}
Пример #15
0
 /**
  * Sets up navigation entries.
  *
  * @param stdClass $instancesnode
  * @param stdClass $instance
  * @return void
  */
 public function add_course_navigation($instancesnode, stdClass $instance)
 {
     if ($instance->enrol !== 'auto') {
         throw new coding_exception('Invalid enrol instance type!');
     }
     $context = context_course::instance($instance->courseid);
     if (has_capability('enrol/auto:config', $context)) {
         $managelink = new moodle_url('/enrol/auto/edit.php', array('courseid' => $instance->courseid, 'id' => $instance->id));
         $instancesnode->add($this->get_instance_name($instance), $managelink, navigation_node::TYPE_SETTING);
     }
 }
Пример #16
0
 /**
  * Checks for existence of message queue tables
  *
  * Should probably examine the contents as well, but this
  * will do for now
  * @param stdClass $db
  * @return boolean
  */
 private function hasQueueTables($db)
 {
     try {
         $db->describeTable('message');
     } catch (Exception $e) {
         return false;
     }
     try {
         $db->describeTable('queue');
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
Пример #17
0
 /**
  * Returns playerTotal if player has a playerTotal
  * else returns a stdClass with id set to 0
  *
  * @return stdClass or PlayerTotal
  */
 public function playerTotal()
 {
     $pt = $this->alias->playerTotal();
     if ($pt->first() == null) {
         $pt = new \stdClass();
         $pt->id = 0;
         $pt->name = "Unknown";
         $pt->rank = new \stdClass();
         $pt->rank->id = 1;
         $pt->rank->shortname = 'NON';
         $pt->rank->name = "None";
         return $pt;
     }
     return $pt->first();
 }
Пример #18
0
 /**
  * Seta o RP da página
  * @param boolean $isStatic
  * @param integer $rp
  */
 public function setRp($isStatic, $rp)
 {
     $this->rpObj = new \wow\database\rp\Rp($rp);
     if (!$isStatic) {
         $this->rpObj->isDynamic();
     }
 }
Пример #19
0
 public function Render($controllerName = '', $actionName = '')
 {
     if ($this->viewEnabled) {
         if (!$controllerName) {
             $controllerName = $this->request->params['controller'];
         }
         if (!$actionName) {
             $actionName = $this->request->params['action'];
         }
         // complete paths
         $controllerPath = str_replace('_', DIRECTORY_SEPARATOR, $controllerName);
         $viewScriptPath = implode(DIRECTORY_SEPARATOR, array($controllerPath, $actionName));
         // render content string
         $actionResult = $this->view->RenderScript($viewScriptPath);
         // create parent layout view, set up and render to outputResult
         $layout = new MvcCore_View($this);
         $layout->SetUp($this->view);
         $outputResult = $layout->RenderLayout($this->layout, $actionResult);
         unset($layout, $this->view);
         // minify if class exists
         if ($this->minifyHtml && class_exists('Minify_HTML')) {
             $outputResult = Minify_HTML::minify($outputResult);
         }
         // send response and exit
         $this->HtmlResponse($outputResult);
     }
 }
 /**
  * Gets and array of other users.
  *
  * Other users are users who have been assigned roles or inherited roles
  * within this course but who have not been enrolled in the course
  *
  * @global moodle_database $DB
  * @param string $sort
  * @param string $direction
  * @param int $page
  * @param int $perpage
  * @return array
  */
 public function get_other_users($sort, $direction='ASC', $page=0, $perpage=25) {
     global $DB;
     if ($direction !== 'ASC') {
         $direction = 'DESC';
     }
     $key = md5("$sort-$direction-$page-$perpage");
     if (!array_key_exists($key, $this->otherusers)) {
         list($ctxcondition, $params) = $DB->get_in_or_equal($this->context->get_parent_context_ids(true), SQL_PARAMS_NAMED, 'ctx');
         $params['courseid'] = $this->course->id;
         $params['cid'] = $this->course->id;
         $sql = "SELECT ra.id as raid, ra.contextid, ra.component, ctx.contextlevel, ra.roleid, u.*, ue.lastseen
                 FROM {role_assignments} ra
                 JOIN {user} u ON u.id = ra.userid
                 JOIN {context} ctx ON ra.contextid = ctx.id
            LEFT JOIN (
                    SELECT ue.id, ue.userid, ul.timeaccess AS lastseen
                      FROM {user_enrolments} ue
                 LEFT JOIN {enrol} e ON e.id=ue.enrolid
                 LEFT JOIN {user_lastaccess} ul ON (ul.courseid = e.courseid AND ul.userid = ue.userid)
                     WHERE e.courseid = :courseid
                    ) ue ON ue.userid=u.id
                WHERE ctx.id $ctxcondition AND
                      ue.id IS NULL
             ORDER BY u.$sort $direction, ctx.depth DESC";
         $this->otherusers[$key] = $DB->get_records_sql($sql, $params, $page*$perpage, $perpage);
     }
     return $this->otherusers[$key];
 }
Пример #21
0
 /**
  * Method to get the data that should be injected in the form.
  *
  * @return	mixed	The data for the form.
  * @since	1.6
  */
 protected function loadFormData()
 {
     if ($this->data === null) {
         $userId = $this->state->get('user.id');
         // Initialise the table with JUser.
         $this->data = new JUser($userId);
         // Set the base user data.
         $this->data->email1 = $this->data->get('email');
         $this->data->email2 = $this->data->get('email');
         // Override the base user data with any data in the session.
         $temp = (array) JFactory::getApplication()->getUserState('com_users.registration.data', array());
         foreach ($temp as $k => $v) {
             $this->data->{$k} = $v;
         }
         // Unset the passwords.
         unset($this->data->password1);
         unset($this->data->password2);
         $registry = new JRegistry($this->data->params);
         $this->data->params = $registry->toArray();
         // Get the dispatcher and load the users plugins.
         JPluginHelper::importPlugin('user');
         // Trigger the data preparation event.
         $results = JFactory::getApplication()->triggerEvent('onContentPrepareData', array('com_userxtd.profile', $this->data));
         // Check for errors encountered while preparing the data.
         if (count($results) && in_array(false, $results, true)) {
             //$this->setError($dispatcher->getError());
             $this->data = false;
         }
     }
     return $this->data;
 }
Пример #22
0
 /**
  * Move file from the temporary destination to the original destination
  *
  * @param \stdClass $file
  * @throws File\Exception
  */
 public static final function moveFile($file)
 {
     try {
         if ($file->is_temp) {
             rename($file->temp_destination . '/' . $file->temp_name, $file->original_destination . '/' . $file->temp_name);
             if (!file_exists($file->original_destination . '/' . $file->temp_name)) {
                 throw new CannotSaveFileInHardDriveException();
             }
             $file->is_temp = false;
             $file->expire = null;
             $file->save();
         }
     } catch (\Exception $exception) {
         throw new FileException($exception->getMessage());
     }
 }
Пример #23
0
/**
 * Form for editing HTML block instances.
 *
 * @copyright 2010 Petr Skoda (http://skodak.org)
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @package   block_html
 * @category  files
 * @param stdClass $course course object
 * @param stdClass $birecord_or_cm block instance record
 * @param stdClass $context context object
 * @param string $filearea file area
 * @param array $args extra arguments
 * @param bool $forcedownload whether or not force download
 * @param array $options additional options affecting the file serving
 * @return bool
 * @todo MDL-36050 improve capability check on stick blocks, so we can check user capability before sending images.
 */
function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload, array $options = array())
{
    global $DB, $CFG;
    if ($context->contextlevel != CONTEXT_BLOCK) {
        send_file_not_found();
    }
    // If block is in course context, then check if user has capability to access course.
    if ($context->get_course_context(false)) {
        require_course_login($course);
    } else {
        if ($CFG->forcelogin) {
            require_login();
        } else {
            // Get parent context and see if user have proper permission.
            $parentcontext = $context->get_parent_context();
            if ($parentcontext->contextlevel === CONTEXT_COURSECAT) {
                // Check if category is visible and user can view this category.
                $category = $DB->get_record('course_categories', array('id' => $parentcontext->instanceid), '*', MUST_EXIST);
                if (!$category->visible) {
                    require_capability('moodle/category:viewhiddencategories', $parentcontext);
                }
            }
            // At this point there is no way to check SYSTEM or USER context, so ignoring it.
        }
    }
    if ($filearea !== 'content') {
        send_file_not_found();
    }
    $fs = get_file_storage();
    $filename = array_pop($args);
    $filepath = $args ? '/' . implode('/', $args) . '/' : '/';
    if (!($file = $fs->get_file($context->id, 'block_html', 'content', 0, $filepath, $filename)) or $file->is_directory()) {
        send_file_not_found();
    }
    if ($parentcontext = get_context_instance_by_id($birecord_or_cm->parentcontextid)) {
        if ($parentcontext->contextlevel == CONTEXT_USER) {
            // force download on all personal pages including /my/
            //because we do not have reliable way to find out from where this is used
            $forcedownload = true;
        }
    } else {
        // weird, there should be parent context, better force dowload then
        $forcedownload = true;
    }
    session_get_instance()->write_close();
    send_stored_file($file, 60 * 60, 0, $forcedownload, $options);
}
Пример #24
0
 public function testProcessRequestTrue()
 {
     $response = new Zend_Controller_Response_Http();
     $response->setBody('Initial response body.');
     $this->_requestProcessor->expects($this->any())->method('extractContent')->will($this->returnValue('Additional response text.'));
     $this->assertTrue($this->_model->processRequest($response));
     $this->assertEquals('Initial response body.Additional response text.', $response->getBody());
 }
Пример #25
0
 /**
  * Test new_submission_empty
  *
  * @dataProvider submission_is_empty_testcases
  * @param string $submissiontext The file submission data
  * @param bool $expected The expected return value
  */
 public function test_new_submission_empty($submissiontext, $expected)
 {
     $this->resetAfterTest();
     $data = new stdClass();
     $data->onlinetext_editor = ['text' => $submissiontext];
     $result = $this->assign->new_submission_empty($data);
     $this->assertTrue($result === $expected);
 }
 /**
  * Add appropriate form elements to the criteria form
  *
  * @param moodleform $mform  Moodle forms object
  * @param stdClass $data details of various modules
  */
 public function config_form_criteria($data)
 {
     global $OUTPUT;
     $editurl = new moodle_url('/badges/criteria_settings.php', array('badgeid' => $this->badgeid, 'edit' => true, 'type' => $this->criteriatype, 'crit' => $this->id));
     $deleteurl = new moodle_url('/badges/criteria_action.php', array('badgeid' => $this->badgeid, 'delete' => true, 'type' => $this->criteriatype));
     $editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit')), null, array('class' => 'criteria-action'));
     $deleteaction = $OUTPUT->action_icon($deleteurl, new pix_icon('t/delete', get_string('delete')), null, array('class' => 'criteria-action'));
     echo $OUTPUT->box_start();
     if (!$data->is_locked() && !$data->is_active()) {
         echo $OUTPUT->box($deleteaction . $editaction, array('criteria-header'));
     }
     echo $OUTPUT->heading($this->get_title() . $OUTPUT->help_icon('criteria_' . $this->criteriatype, 'badges'), 3, 'main help');
     if (!empty($this->params)) {
         echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges') . $this->get_details(), array('clearfix'));
     }
     echo $OUTPUT->box_end();
 }
 /**
  * @param ObserverInterface $observer
  * @param \Rx\SchedulerInterface|null $scheduler
  * @return DisposableInterface
  */
 public function subscribe(ObserverInterface $observer, \Rx\SchedulerInterface $scheduler = null)
 {
     $this->object->on($this->nextAction, function () use($observer) {
         $observer->onNext(func_get_args());
     });
     if ($this->errorAction) {
         $this->object->on($this->errorAction, function ($error = null) use($observer) {
             $ex = $error instanceof \Exception ? $error : new \Exception($error);
             $observer->onError($ex);
         });
     }
     if ($this->completeAction) {
         $this->object->on($this->completeAction, function () use($observer) {
             $observer->onCompleted();
         });
     }
     return new EmptyDisposable();
 }
Пример #28
0
 public function testQueueInfo()
 {
     $this->assertNull($this->provider->queueInfo());
     $this->provider->create();
     $queue = $this->provider->queueInfo();
     $this->assertEquals('530295fe3c94fbcf0c79cffe', $queue->id);
     $this->assertEquals('test', $queue->name);
     $this->assertEquals('52f67d032001c00005000057', $queue->project_id);
 }
 /**
  * Displays the ngglegacy thumbnail gallery.
  * This method deprecates the use of the nggShowGallery() function.
  * @param stdClass|C_Displayed_Gallery|C_DataMapper_Model $displayed_gallery
  */
 function index_action($displayed_gallery, $return = FALSE)
 {
     // Get the images to be displayed
     $current_page = (int) $this->param('page', 1);
     // TODO: Shouldn't we be using maximum_entity_count instead?
     $limit = FALSE;
     if (in_array($displayed_gallery->source, array('random_images', 'recent_images'))) {
         $limit = $displayed_gallery->display_settings['images_per_page'];
     }
     if ($images = $displayed_gallery->get_included_entities($limit)) {
         // Get the gallery storage component
         $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
         // Create parameter list for the view
         $params = $displayed_gallery->display_settings;
         $params['storage'] =& $storage;
         $params['images'] =& $images;
         $params['displayed_gallery_id'] = $displayed_gallery->id();
         $params['current_page'] = $current_page;
         $params['effect_code'] = $this->object->get_effect_code($displayed_gallery);
         $params['anchor'] = 'ngg-slideshow-' . $displayed_gallery->id() . '-' . rand(1, getrandmax()) . $current_page;
         $gallery_width = $displayed_gallery->display_settings['gallery_width'];
         $gallery_height = $displayed_gallery->display_settings['gallery_height'];
         $params['aspect_ratio'] = $gallery_width / $gallery_height;
         $params['flash_path'] = $this->object->get_static_url('photocrati-nextgen_basic_gallery#slideshow/imagerotator.swf');
         $params['placeholder'] = $this->object->get_static_url('photocrati-nextgen_basic_gallery#slideshow/placeholder.gif');
         // Are we displayed a flash slideshow?
         if ($displayed_gallery->display_settings['flash_enabled']) {
             include_once path_join(NGGALLERY_ABSPATH, implode(DIRECTORY_SEPARATOR, array('lib', 'swfobject.php')));
             $transient_id = $displayed_gallery->transient_id;
             $params['mediarss_link'] = $this->get_router()->get_url('/nextgen-mediarss?template=playlist_feed&source=displayed_gallery&transient_id=' . $transient_id, false);
         }
         // Are we to generate a thumbnail link?
         if ($displayed_gallery->display_settings['show_thumbnail_link']) {
             $params['thumbnail_link'] = $this->object->get_url_for_alternate_display_type($displayed_gallery, NEXTGEN_GALLERY_BASIC_THUMBNAILS);
         }
         $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
         $retval = $this->object->render_partial('photocrati-nextgen_basic_gallery#slideshow/index', $params, $return);
     } else {
         $retval = $this->object->render_partial('photocrati-nextgen_gallery_display#no_images_found', array(), $return);
     }
     return $retval;
 }
 /**
  * Reescrita do Metodo Footer da Classe FPDF
  *
  * @see FPDF::Footer()
  */
 public function Footer()
 {
     $this->SetFont('Arial', 'I', 6);
     $this->SetY(-10);
     $sRodape = "Sistema: EcidadeOnline2 - Login: {$this->oDadosUsuario->getLogin()}";
     $sRodape .= " ({$this->oDadosUsuario->getNome()}) ";
     $sRodape .= 'Data/Hora: ' . date('d-m-Y/H:i:s');
     $sPagina = utf8_decode("Página: {$this->PageNo()}");
     $this->Cell(0, 5, $sRodape, 'T', 0, 'L');
     $this->Cell(0, 5, $sPagina, 0, 1, 'R');
 }