public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     if (!isset($configdata['appsid'])) {
         return;
     }
     $apps = self::make_apps_url($configdata['appsid']);
     $url = hsc($apps['url']);
     $type = hsc($apps['type']);
     $height = !empty($configdata['height']) ? intval($configdata['height']) : self::$default_height;
     if (isset($configdata['appsid']) && !empty($type)) {
         $smarty = smarty_core();
         $smarty->assign('url', $apps['url']);
         switch ($type) {
             case 'iframe':
                 // Google Docs (documents, presentations, spreadsheets, forms), Google Calendar, Google Maps
                 $smarty->assign('height', $height);
                 return $smarty->fetch('blocktype:googleapps:iframe.tpl');
             case 'spanicon':
                 // Google Docs collections (folder icon)
                 $smarty->assign('img', get_config('wwwroot') . 'blocktype/googleapps/images/folder_documents.png');
                 return $smarty->fetch('blocktype:googleapps:spanicon.tpl');
             case 'image':
                 // Google Docs drawing
                 $smarty->assign('height', $height);
                 return $smarty->fetch('blocktype:googleapps:image.tpl');
         }
     }
     return get_string('badurlerror', 'blocktype.googleapps', $url);
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     require_once get_config('docroot') . 'artefact/lib.php';
     $smarty = smarty_core();
     $configdata = $instance->get('configdata');
     $data = array();
     // add in the selected email address
     if (!empty($configdata['email'])) {
         $configdata['artefactids'][] = $configdata['email'];
     }
     // Get data about the profile fields in this blockinstance
     if (!empty($configdata['artefactids'])) {
         $viewowner = get_field('view', 'owner', 'id', $instance->get('view'));
         foreach ($configdata['artefactids'] as $id) {
             try {
                 $artefact = artefact_instance_from_id($id);
                 if (is_a($artefact, 'ArtefactTypeProfile') && $artefact->get('owner') == $viewowner) {
                     $rendered = $artefact->render_self(array('link' => true));
                     $data[$artefact->get('artefacttype')] = $rendered['html'];
                 }
             } catch (ArtefactNotFoundException $e) {
                 log_debug('Artefact not found when rendering contactinfo block instance. ' . 'There might be a bug with deleting artefacts of this type? ' . 'Original error follows:');
                 log_debug($e->getMessage());
             }
         }
     }
     $smarty->assign('profileinfo', $data);
     return $smarty->fetch('blocktype:contactinfo:content.tpl');
 }
Exemple #3
0
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     safe_require('artefact', 'survey');
     //require_once(dirname(dirname(dirname(__FILE__))) . '/dwoo/function.survey_name.php');
     $configdata = $instance->get('configdata');
     // this will make sure to unserialize it for us
     if (!isset($configdata['artefactid'])) {
         return '';
     }
     $id = $configdata['artefactid'];
     $survey = $instance->get_artefact_instance($id);
     $showresponses = isset($configdata['showresponses']) ? $configdata['showresponses'] : false;
     $showresults = isset($configdata['showresults']) ? $configdata['showresults'] : true;
     $showchart = isset($configdata['showchart']) ? $configdata['showchart'] : true;
     $palette = isset($configdata['palette']) ? $configdata['palette'] : 'default';
     $legend = isset($configdata['legend']) ? $configdata['legend'] : 'key';
     $fonttype = isset($configdata['fonttype']) ? $configdata['fonttype'] : 'sans';
     $fontsize = isset($configdata['fontsize']) ? $configdata['fontsize'] : 10;
     $height = isset($configdata['height']) ? $configdata['height'] : 250;
     $width = isset($configdata['width']) ? $configdata['width'] : 400;
     $smarty = smarty_core();
     //$smarty->addPlugin('survey_name', 'Dwoo_Plugin_survey_name');
     $smarty->assign('RESPONSES', $showresponses ? true : false);
     $smarty->assign('responseshtml', ArtefactTypeSurvey::build_user_responses_output_html($survey->get('title'), unserialize($survey->get('description'))));
     $smarty->assign('RESULTS', $showresults ? true : false);
     $smarty->assign('resultshtml', ArtefactTypeSurvey::build_user_responses_summary_html($survey->get('title'), unserialize($survey->get('description'))));
     $smarty->assign('CHART', $showchart ? true : false);
     $smarty->assign('charturl', get_config('wwwroot') . 'artefact/survey/chart.php?id=' . $id . '&width=' . $width . '&height=' . $height . '&palette=' . $palette . '&legend=' . $legend . '&fonttype=' . $fonttype . '&fontsize=' . $fontsize);
     return $smarty->fetch('blocktype:survey:survey.tpl');
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $exporter;
     require_once get_config('docroot') . 'artefact/lib.php';
     safe_require('artefact', 'cpds');
     $configdata = $instance->get('configdata');
     $smarty = smarty_core();
     if (isset($configdata['artefactid'])) {
         $cpd = artefact_instance_from_id($configdata['artefactid']);
         $activities = ArtefactTypeActivity::get_activities($configdata['artefactid']);
         $template = 'artefact:cpds:activityrows.tpl';
         $blockid = $instance->get('id');
         if ($exporter) {
             $pagination = false;
         } else {
             $baseurl = $instance->get_view()->get_url();
             $baseurl .= (false === strpos($baseurl, '?') ? '?' : '&') . 'block=' . $blockid;
             $pagination = array('baseurl' => $baseurl, 'id' => 'block' . $blockid . '_pagination', 'datatable' => 'activitytable_' . $blockid, 'jsonscript' => 'artefact/cpds/viewactivities.json.php');
         }
         ArtefactTypeActivity::render_activities($activities, $template, $configdata, $pagination);
         if ($exporter && $activities['count'] > $activities['limit']) {
             $artefacturl = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $configdata['artefactid'] . '&view=' . $instance->get('view');
             $activities['pagination'] = '<a href="' . $artefacturl . '">' . get_string('allactivities', 'artefact.cpds') . '</a>';
         }
         $smarty->assign('description', $cpd->get('description'));
         $smarty->assign('activities', $activities);
         $smarty->assign('owner', $cpd->get('owner'));
         $smarty->assign('tags', $cpd->get('tags'));
     } else {
         $smarty->assign('nocpds', 'blocktype.cpds/cpds');
     }
     $smarty->assign('blockid', $instance->get('id'));
     return $smarty->fetch('blocktype:cpds:content.tpl');
 }
Exemple #5
0
 public static function instance_config_form(BlockInstance $instance)
 {
     $configdata = $instance->get('configdata');
     $options = range(0, 100);
     unset($options[0]);
     return array('numtoshow' => array('type' => 'select', 'title' => get_string('options_numtoshow_title', 'blocktype.groupmembers'), 'description' => get_string('options_numtoshow_desc', 'blocktype.groupmembers'), 'defaultvalue' => !empty($configdata['numtoshow']) ? $configdata['numtoshow'] : self::$default_numtoshow, 'options' => $options), 'order' => array('type' => 'select', 'title' => get_string('options_order_title', 'blocktype.groupmembers'), 'description' => get_string('options_order_desc', 'blocktype.groupmembers'), 'defaultvalue' => !empty($configdata['order']) ? $configdata['order'] : 'latest', 'options' => array('latest' => get_string('Latest', 'blocktype.groupmembers'), 'random' => get_string('Random', 'blocktype.groupmembers'))));
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $THEME;
     $configdata = $instance->get('configdata');
     if (!isset($configdata['license'])) {
         return '';
     }
     $licensetype = reset(preg_grep('/^([a-z\\-]+)$/', array($configdata['license'])));
     if (isset($configdata['version'])) {
         $licenseversion = get_string('version' . $configdata['version'], 'blocktype.creativecommons');
     } else {
         $licenseversion = get_string('version30', 'blocktype.creativecommons');
     }
     $licenseurl = "http://creativecommons.org/licenses/{$licensetype}/{$licenseversion}/";
     $view = $instance->get_view();
     $workname = '<span rel="dc:type" href="http://purl.org/dc/dcmitype/Text" property="dc:title">' . $view->display_title(true, false, false) . '</span>';
     $authorurl = $view->owner_link();
     $authorname = hsc($view->formatted_owner());
     $licensename = get_string('cclicensename', 'blocktype.creativecommons', get_string($licensetype, 'blocktype.creativecommons'), $licenseversion);
     $licenselink = '<a rel="license" href="' . $licenseurl . '">' . $licensename . '</a>';
     $attributionlink = '<a rel="cc:attributionURL" property="cc:attributionName" href="' . $authorurl . '">' . $authorname . '</a>';
     $licensestatement = get_string('cclicensestatement', 'blocktype.creativecommons', $workname, $attributionlink, $licenselink);
     $permissionlink = '<a rel="cc:morePermissions" href="' . $authorurl . '">' . $authorname . '</a>';
     $otherpermissions = get_string('otherpermissions', 'blocktype.creativecommons', $permissionlink);
     $smarty = smarty_core();
     $smarty->assign('licenseurl', $licenseurl);
     $smarty->assign('licenselogo', $THEME->get_url('images/' . $licensetype . '-3_0.png', false, 'blocktype/creativecommons'));
     $smarty->assign('licensestatement', $licensestatement);
     $smarty->assign('otherpermissions', $otherpermissions);
     return $smarty->fetch('blocktype:creativecommons:statement.tpl');
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     // this will make sure to unserialize it for us
     if (!isset($configdata['artefactid'])) {
         return '';
     }
     $id = $configdata['artefactid'];
     $image = $instance->get_artefact_instance($id);
     $wwwroot = get_config('wwwroot');
     $viewid = $instance->get('view');
     if ($image instanceof ArtefactTypeProfileIcon) {
         $src = $wwwroot . 'thumb.php?type=profileiconbyid&id=' . $id;
         $description = $image->get('title');
     } else {
         $src = $wwwroot . 'artefact/file/download.php?file=' . $id . '&view=' . $viewid;
         $description = $image->get('description');
     }
     if (!empty($configdata['width'])) {
         $src .= '&maxwidth=' . $configdata['width'];
     }
     $smarty = smarty_core();
     $smarty->assign('url', $wwwroot . 'artefact/artefact.php?artefact=' . $id . '&view=' . $viewid);
     $smarty->assign('src', $src);
     $smarty->assign('description', $description);
     $smarty->assign('showdescription', !empty($configdata['showdescription']) && !empty($description));
     return $smarty->fetch('blocktype:image:image.tpl');
 }
Exemple #8
0
 public static function instance_config_form(BlockInstance $instance)
 {
     $configdata = $instance->get('configdata');
     safe_require('artefact', 'file');
     $instance->set('artefactplugin', 'file');
     return array('artefactid' => self::filebrowser_element($instance, isset($configdata['artefactid']) ? array($configdata['artefactid']) : null), 'showdescription' => array('type' => 'switchbox', 'title' => get_string('showdescription', 'blocktype.file/image'), 'defaultvalue' => !empty($configdata['showdescription']) ? true : false), 'width' => array('type' => 'text', 'title' => get_string('width', 'blocktype.file/image'), 'size' => 3, 'description' => get_string('widthdescription1', 'blocktype.file/image'), 'rules' => array('minvalue' => 16, 'maxvalue' => get_config('imagemaxwidth')), 'defaultvalue' => isset($configdata['width']) ? $configdata['width'] : ''));
 }
Exemple #9
0
 public static function instance_config_form(BlockInstance $instance)
 {
     $configdata = $instance->get('configdata');
     safe_require('artefact', 'file');
     $instance->set('artefactplugin', 'file');
     return array('artefactfieldset' => array('type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('Files', 'blocktype.file/filedownload'), 'class' => 'last with-formgroup', 'elements' => array('artefactid' => self::filebrowser_element($instance, isset($configdata['artefactids']) ? $configdata['artefactids'] : null))));
 }
Exemple #10
0
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     require_once get_config('docroot') . 'artefact/lib.php';
     $smarty = smarty_core();
     //$configdata = $instance->get('configdata');
     //$configdata['viewid'] = $instance->get('view');
     // Get data about the resume fields the user has
     $return = '';
     if ($artefacts = get_records_sql_array('
         SELECT va.artefact, a.artefacttype
         FROM {view_artefact} va
         INNER JOIN {artefact} a ON (va.artefact = a.id)
         WHERE va.view = ?
         AND va.block = ?', array($instance->get('view'), $instance->get('id')))) {
         foreach ($artefacts as $artefact) {
             $resumefield = $instance->get_artefact_instance($artefact->artefact);
             $rendered = $resumefield->render_self(array('viewid' => $instance->get('view')));
             $result = $rendered['html'];
             if (!empty($rendered['javascript'])) {
                 $result .= '<script type="text/javascript">' . $rendered['javascript'] . '</script>';
             }
             $smarty->assign($artefact->artefacttype, $result);
         }
     }
     return $smarty->fetch('blocktype:entireresume:content.tpl');
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     require_once get_config('docroot') . 'artefact/lib.php';
     $configdata = $instance->get('configdata');
     $viewid = $instance->get('view');
     $wwwroot = get_config('wwwroot');
     $files = array();
     if (isset($configdata['artefactids']) && is_array($configdata['artefactids'])) {
         foreach ($configdata['artefactids'] as $artefactid) {
             try {
                 $artefact = $instance->get_artefact_instance($artefactid);
             } catch (ArtefactNotFoundException $e) {
                 continue;
             }
             $file = array('id' => $artefactid, 'title' => $artefact->get('title'), 'description' => $artefact->get('description'), 'size' => $artefact->get('size'), 'ctime' => $artefact->get('ctime'), 'iconsrc' => call_static_method(generate_artefact_class_name($artefact->get('artefacttype')), 'get_icon', array('id' => $artefactid, 'viewid' => $viewid)), 'downloadurl' => $wwwroot);
             if ($artefact instanceof ArtefactTypeProfileIcon) {
                 $file['downloadurl'] .= 'thumb.php?type=profileiconbyid&id=' . $artefactid;
             } else {
                 if ($artefact instanceof ArtefactTypeFile) {
                     $file['downloadurl'] .= 'artefact/file/download.php?file=' . $artefactid . '&view=' . $viewid;
                 }
             }
             $files[] = $file;
         }
     }
     $smarty = smarty_core();
     $smarty->assign('viewid', $instance->get('view'));
     $smarty->assign('files', $files);
     return $smarty->fetch('blocktype:filedownload:filedownload.tpl');
 }
Exemple #12
0
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     $result = '';
     if (!empty($configdata['artefactids'])) {
         $artefactids = implode(', ', array_map('db_quote', $configdata['artefactids']));
         if (!($mostrecent = get_records_sql_array('SELECT a.title, ' . db_format_tsfield('a.ctime', 'ctime') . ', p.title AS parenttitle, a.id, a.parent
             FROM {artefact} a
             JOIN {artefact} p ON a.parent = p.id
             WHERE a.artefacttype = \'blogpost\'
             AND a.parent IN ( ' . $artefactids . ' ) 
             AND a.owner = (SELECT owner from {view} WHERE id = ?)
             ORDER BY a.ctime DESC
             LIMIT 10', array($instance->get('view'))))) {
             $mostrecent = array();
         }
         // format the dates
         foreach ($mostrecent as &$data) {
             $data->displaydate = format_date($data->ctime);
         }
         $smarty = smarty_core();
         $smarty->assign('mostrecent', $mostrecent);
         $smarty->assign('view', $instance->get('view'));
         $result = $smarty->fetch('blocktype:recentposts:recentposts.tpl');
     }
     return $result;
 }
Exemple #13
0
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     safe_require('artefact', 'survey');
     //require_once(dirname(dirname(dirname(__FILE__))) . '/dwoo/function.survey_name.php');
     $configdata = $instance->get('configdata');
     // this will make sure to unserialize it for us
     $survey = isset($configdata['survey']) ? $configdata['survey'] : '';
     $userid = isset($configdata['userid']) ? $configdata['userid'] : '';
     //$showresponses = (isset($configdata['showresponses']) ? $configdata['showresponses'] : false);
     //$showresults = (isset($configdata['showresults']) ? $configdata['showresults'] : true);
     $showchart = isset($configdata['showchart']) ? $configdata['showchart'] : true;
     $palette = isset($configdata['palette']) ? $configdata['palette'] : 'default';
     $legend = isset($configdata['legend']) ? $configdata['legend'] : 'key';
     $fonttype = isset($configdata['fonttype']) ? $configdata['fonttype'] : 'sans';
     $fontsize = isset($configdata['fontsize']) ? $configdata['fontsize'] : 10;
     $height = isset($configdata['height']) ? $configdata['height'] : 250;
     $width = isset($configdata['width']) ? $configdata['width'] : 400;
     $artefactids = get_records_sql_array("SELECT\ta.id\n\t\t\tFROM {artefact} a\n\t\t\tWHERE a.artefacttype = 'survey' AND a.title = ? AND a.owner = ?\n\t\t\tORDER BY a.ctime DESC, a.mtime DESC", array($survey, $userid));
     $data = array();
     $first = true;
     foreach ($artefactids as $artefactid) {
         if ($first) {
             $alpha = 30;
         } else {
             $alpha = 10;
         }
         $data[] = array('id' => $artefactid->id, 'palette' => $palette, 'legend' => $legend, 'fonttype' => $fonttype, 'fontsize' => $fontsize, 'height' => $height, 'width' => $width, 'alpha' => $alpha);
         $first = false;
     }
     $smarty = smarty_core();
     //$smarty->addPlugin('survey_name', 'Dwoo_Plugin_survey_name');
     $smarty->assign('CHART', $showchart ? true : false);
     $smarty->assign('data', $data);
     return $smarty->fetch('blocktype:surveyhistory:surveyhistory.tpl');
 }
Exemple #14
0
 public static function instance_config_form(BlockInstance $instance)
 {
     $configdata = $instance->get('configdata');
     safe_require('artefact', 'file');
     $instance->set('artefactplugin', 'file');
     return array('artefactids' => self::filebrowser_element($instance, isset($configdata['artefactids']) ? $configdata['artefactids'] : null));
 }
Exemple #15
0
 public static function instance_config_form(BlockInstance $instance)
 {
     $configdata = $instance->get('configdata');
     safe_require('artefact', 'file');
     $instance->set('artefactplugin', 'file');
     return array('artefactfieldset' => array('type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('file', 'artefact.file'), 'class' => 'last select-file mtl', 'elements' => array('artefactid' => self::filebrowser_element($instance, isset($configdata['artefactid']) ? array($configdata['artefactid']) : null))));
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $USER;
     $configdata = $instance->get('configdata');
     $limit = isset($configdata['count']) ? (int) $configdata['count'] : 10;
     $userid = $USER->get('id');
     $smarty = smarty_core();
     $sql = '
         SELECT v.id, v.title, v.owner, v.group, v.institution, v.ownerformat, v.urlid
         FROM {view} v
         JOIN {usr_watchlist_view} wv ON wv.view = v.id
         WHERE wv.usr = ?
         ORDER BY v.title
         LIMIT ?';
     $results = get_records_sql_assoc($sql, array($userid, $limit));
     // if there are no watched views, notify the user
     if (!$results) {
         $smarty->assign('watchlistempty', true);
         return $smarty->fetch('blocktype:watchlist:watchlist.tpl');
     }
     View::get_extra_view_info($results, false, false);
     foreach ($results as &$r) {
         $r = (object) $r;
     }
     $smarty->assign('blockid', 'blockinstance_' . $instance->get('id'));
     $smarty->assign('views', array_values($results));
     return $smarty->fetch('blocktype:watchlist:watchlist.tpl');
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $USER;
     $configdata = $instance->get('configdata');
     $type = isset($configdata['displaytype']) ? $configdata['displaytype'] : 'texticon';
     $showicon = $type == 'icononly' || $type == 'texticon' ? true : false;
     $showtext = $type == 'textonly' || $type == 'texticon' ? true : false;
     // Whether to include email button
     if (isset($configdata['displayemail']) && $configdata['displayemail']) {
         $email = get_field('artefact_internal_profile_email', 'email', 'principal', 1, 'owner', $instance->get('view_obj')->get('owner'));
     } else {
         $email = false;
     }
     if (!isset($configdata['artefactids']) || empty($configdata['artefactids'])) {
         // When we first come into this block, it will have
         // no social profiles configured yet.
         $configdata['artefactids'] = array(0);
     }
     // Include selected social profiles
     $sql = 'SELECT title, description, note FROM {artefact}
         WHERE id IN (' . join(',', $configdata['artefactids']) . ')
             AND owner = ? AND artefacttype = ?
         ORDER BY description ASC';
     if (!($data = get_records_sql_array($sql, array($USER->get('id'), 'socialprofile')))) {
         $data = array();
     }
     safe_require('artefact', 'internal');
     $data = ArtefactTypeSocialprofile::get_profile_icons($data);
     $smarty = smarty_core();
     $smarty->assign('showicon', $showicon);
     $smarty->assign('showtext', $showtext);
     $smarty->assign('profiles', $data);
     $smarty->assign('email', $email);
     return $smarty->fetch('blocktype:socialprofile:content.tpl');
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     if (!isset($configdata['showgroupviews'])) {
         // If not set, use default
         $configdata['showgroupviews'] = 1;
     }
     if (!isset($configdata['showsharedviews'])) {
         $configdata['showsharedviews'] = 1;
     }
     if (!isset($configdata['showsharedcollections'])) {
         $configdata['showsharedcollections'] = 1;
     }
     if (!isset($configdata['showsubmitted'])) {
         $configdata['showsubmitted'] = 1;
     }
     $groupid = $instance->get_view()->get('group');
     if (!$groupid) {
         return '';
     }
     $data = self::get_data($groupid, $editing);
     $dwoo = smarty_core();
     $dwoo->assign('group', $data['group']);
     $dwoo->assign('groupid', $data['group']->id);
     $baseurl = $instance->get_view()->get_url();
     $baseurl .= (strpos($baseurl, '?') === false ? '?' : '&') . 'group=' . $groupid;
     if (!empty($configdata['showgroupviews']) && isset($data['groupviews'])) {
         $groupviews = (array) $data['groupviews'];
         $pagination = array('baseurl' => $baseurl, 'id' => 'groupviews_pagination', 'datatable' => 'groupviewlist', 'jsonscript' => 'blocktype/groupviews/groupviews.json.php', 'resultcounttextsingular' => get_string('view', 'view'), 'resultcounttextplural' => get_string('views', 'view'));
         self::render_items($groupviews, 'blocktype:groupviews:groupviewssection.tpl', $configdata, $pagination);
         $dwoo->assign('groupviews', $groupviews);
     }
     if (!empty($configdata['showsharedviews']) && isset($data['sharedviews'])) {
         $sharedviews = (array) $data['sharedviews'];
         $pagination = array('baseurl' => $baseurl, 'id' => 'sharedviews_pagination', 'datatable' => 'sharedviewlist', 'jsonscript' => 'blocktype/groupviews/sharedviews.json.php', 'resultcounttextsingular' => get_string('view', 'view'), 'resultcounttextplural' => get_string('views', 'view'));
         self::render_items($sharedviews, 'blocktype:groupviews:sharedviews.tpl', $configdata, $pagination);
         $dwoo->assign('sharedviews', $sharedviews);
     }
     if (!empty($configdata['showsharedcollections']) && isset($data['sharedcollections'])) {
         $sharedcollections = (array) $data['sharedcollections'];
         $pagination = array('baseurl' => $baseurl, 'id' => 'sharedcollections_pagination', 'datatable' => 'sharedcollectionlist', 'jsonscript' => 'blocktype/groupviews/sharedcollections.json.php', 'resultcounttextsingular' => get_string('collection', 'collection'), 'resultcounttextplural' => get_string('collections', 'collection'));
         self::render_items($sharedcollections, 'blocktype:groupviews:sharedcollections.tpl', $configdata, $pagination);
         $dwoo->assign('sharedcollections', $sharedcollections);
     }
     if (!empty($configdata['showsubmitted']) && isset($data['allsubmitted'])) {
         $allsubmitted = $data['allsubmitted'];
         $pagination = array('baseurl' => $baseurl, 'id' => 'allsubmitted_pagination', 'datatable' => 'allsubmissionlist', 'jsonscript' => 'blocktype/groupviews/allsubmissions.json.php', 'resultcounttextsingular' => get_string('vieworcollection', 'view'), 'resultcounttextplural' => get_string('viewsandcollections', 'view'));
         self::render_items($allsubmitted, 'blocktype:groupviews:allsubmissions.tpl', $configdata, $pagination);
         $dwoo->assign('allsubmitted', $allsubmitted);
     }
     if (isset($data['mysubmitted'])) {
         $dwoo->assign('mysubmitted', $data['mysubmitted']);
     }
     if (!$editing && isset($data['group_view_submission_form'])) {
         $dwoo->assign('group_view_submission_form', $data['group_view_submission_form']);
     }
     return $dwoo->fetch('blocktype:groupviews:groupviews.tpl');
 }
Exemple #19
0
 public static function instance_config_form(BlockInstance $instance)
 {
     $instance->set('artefactplugin', 'plans');
     $configdata = $instance->get('configdata');
     $form = array();
     // Which resume field does the user want
     $form[] = self::artefactchooser_element(isset($configdata['artefactid']) ? $configdata['artefactid'] : null);
     return $form;
 }
Exemple #20
0
 public static function override_instance_title(BlockInstance $instance)
 {
     global $USER;
     $ownerid = $instance->get_view()->get('owner');
     if ($ownerid === null || $ownerid == $USER->get('id')) {
         return get_string('title', 'blocktype.myviews');
     }
     return get_string('otherusertitle', 'blocktype.myviews', display_name($ownerid, null, true));
 }
Exemple #21
0
 public static function instance_config_form(BlockInstance $instance)
 {
     $configdata = $instance->get('configdata');
     $form = array();
     // Which social profiles does the user want
     $form[] = self::artefactchooser_element(isset($configdata['artefactids']) ? $configdata['artefactids'] : null);
     $form['settings'] = array('type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'class' => 'first last', 'legend' => get_string('displaysettings', 'blocktype.internal/socialprofile'), 'elements' => array('displaytype' => array('type' => 'radio', 'labelhtml' => '<span class="pseudolabel">' . get_string('displayaddressesas', 'blocktype.internal/socialprofile') . '</span>', 'defaultvalue' => !empty($configdata['displaytype']) ? $configdata['displaytype'] : 'texticon', 'options' => array('icononly' => get_string('optionicononly', 'blocktype.internal/socialprofile'), 'texticon' => get_string('optiontexticon', 'blocktype.internal/socialprofile'), 'textonly' => get_string('optiontextonly', 'blocktype.internal/socialprofile'))), 'displayemail' => array('type' => 'switchbox', 'labelhtml' => '<span class="pseudolabel">' . get_string('displaydefaultemail', 'blocktype.internal/socialprofile') . '</span>', 'defaultvalue' => !empty($configdata['displayemail']) ? $configdata['displayemail'] : 0)));
     return $form;
 }
Exemple #22
0
 /**
  * Returns a list of artefact IDs that are in this blockinstance.
  *
  * People may embed artefacts as images etc. They show up as links to the 
  * download script, which isn't much to go on, but should be enough for us 
  * to detect that the artefacts are therefore 'in' this blocktype.
  */
 public static function get_artefacts(BlockInstance $instance)
 {
     $artefacts = array();
     $configdata = $instance->get('configdata');
     if (isset($configdata['text'])) {
         require_once get_config('docroot') . 'artefact/lib.php';
         $artefacts = artefact_get_references_in_html($configdata['text']);
     }
     return $artefacts;
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     $type = isset($configdata['linkedindata']) ? $configdata['linkedindata'] : 'basicprofile';
     $owner = $instance->get_view()->get('owner');
     $profile = self::get_user_profile($type, $owner);
     $smarty = smarty_core();
     $smarty->assign('profile', $profile);
     return $smarty->fetch('blocktype:linkedinprofile:' . $type . '.tpl');
 }
Exemple #24
0
 public static function instance_config_form(BlockInstance $instance)
 {
     $instance->set('artefactplugin', 'plans');
     $configdata = $instance->get('configdata');
     $form = array();
     // Which resume field does the user want
     $form[] = self::artefactchooser_element(isset($configdata['artefactid']) ? $configdata['artefactid'] : null);
     $form['count'] = array('type' => 'text', 'title' => get_string('taskstodisplay', 'blocktype.plans/plans'), 'defaultvalue' => isset($configdata['count']) ? $configdata['count'] : 10, 'size' => 3);
     return $form;
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $CFG;
     safe_require('artefact', 'courses');
     $configdata = $instance->get('configdata');
     $list_size = isset($configdata['maxcourses']) ? $configdata['maxcourses'] : 8;
     $smarty = smarty_core();
     $smarty->assign('list_size', $list_size);
     $smarty->assign('view', $instance->get('view'));
     return $smarty->fetch('blocktype:mycourses:mycourses.tpl');
 }
Exemple #26
0
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $groupid = $instance->get_view()->get('group');
     if (!$groupid) {
         return '';
     }
     $data = self::get_data($groupid);
     $dwoo = smarty_core();
     $dwoo->assign('group', $data);
     $dwoo->assign('editwindow', group_format_editwindow($data));
     return $dwoo->fetch('blocktype:groupinfo:groupinfo.tpl');
 }
 /**
  * Returns a list of artefact IDs that are in this blockinstance.
  *
  * Normally this would just include the blogpost ID itself (children such
  * as attachments don't need to be included here, they're handled by the
  * artefact parent cache). But people might just link to artefacts without
  * using the attachment facility. There's nothing wrong with them doing
  * that, so if they do we should scrape the post looking for such links and
  * include those artefacts as being part of this blockinstance.
  *
  * @return array List of artefact IDs that are 'in' this blogpost - all
  *               the blogpost ID plus links to other artefacts that are
  *               part of the blogpost text. Note that proper artefact
  *               children, such as blog post attachments, aren't included -
  *               the artefact parent cache is used for them
  * @see PluginBlocktypeBlog::get_artefacts()
  */
 public static function get_artefacts(BlockInstance $instance)
 {
     $configdata = $instance->get('configdata');
     $artefacts = array();
     if (isset($configdata['artefactid'])) {
         $artefacts[] = $configdata['artefactid'];
         // Add all artefacts found in the blogpost text
         $blogpost = $instance->get_artefact_instance($configdata['artefactid']);
         $artefacts = array_unique(array_merge($artefacts, $blogpost->get_referenced_artefacts_from_postbody()));
     }
     return $artefacts;
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     $smarty = smarty_core();
     if (!empty($configdata['collection'])) {
         $sql = "SELECT cv.*, v.title\n                    FROM {collection_view} cv\n                        LEFT JOIN {collection} c ON cv.collection = c.id\n                        LEFT JOIN {view} v ON cv.view = v.id\n                    WHERE c.id = ?\n                    ORDER BY cv.displayorder, v.title, v.ctime ASC";
         if ($views = get_records_sql_array($sql, array($configdata['collection']))) {
             $smarty->assign('views', $views);
         }
     }
     $smarty->assign('currentview', $instance->get('view'));
     return $smarty->fetch('blocktype:navigation:navigation.tpl');
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     $smarty = smarty_core();
     if (!empty($configdata['collection'])) {
         $views = $instance->get_data('collection', $configdata['collection'])->views();
         if (!empty($views)) {
             $smarty->assign('views', $views['views']);
         }
     }
     $smarty->assign('currentview', $instance->get('view'));
     return $smarty->fetch('blocktype:navigation:navigation.tpl');
 }
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $USER;
     require_once 'view.php';
     $configdata = $instance->get('configdata');
     $nviews = isset($configdata['limit']) ? intval($configdata['limit']) : 5;
     $sort = array(array('column' => 'mtime', 'desc' => true));
     $views = View::view_search(null, null, null, null, $nviews, 0, true, $sort, array('portfolio'));
     $smarty = smarty_core();
     $smarty->assign('loggedin', $USER->is_logged_in());
     $smarty->assign('views', $views->data);
     return $smarty->fetch('blocktype:newviews:newviews.tpl');
 }