本文整理汇总了PHP中BlockInstance类的典型用法代码示例。如果您正苦于以下问题:PHP BlockInstance类的具体用法?PHP BlockInstance怎么用?PHP BlockInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BlockInstance类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render_instance
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);
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:30,代码来源:lib.php
示例2: render_instance
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');
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:29,代码来源:lib.php
示例3: render_instance
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');
}
开发者ID:gbleydon,项目名称:mahara-survey,代码行数:30,代码来源:lib.php
示例4: render_instance
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');
}
开发者ID:ngson2000,项目名称:mahara-artefact_cpds,代码行数:34,代码来源:lib.php
示例5: instance_config_form
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'))));
}
开发者ID:rboyatt,项目名称:mahara,代码行数:7,代码来源:lib.php
示例6: render_instance
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');
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:28,代码来源:lib.php
示例7: instance_config_form
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'] : ''));
}
开发者ID:vohung96,项目名称:mahara,代码行数:7,代码来源:lib.php
示例8: instance_config_form
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))));
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:7,代码来源:lib.php
示例9: render_instance
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');
}
开发者ID:Br3nda,项目名称:mahara,代码行数:26,代码来源:lib.php
示例10: render_instance
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');
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:30,代码来源:lib.php
示例11: render_instance
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;
}
开发者ID:Br3nda,项目名称:mahara,代码行数:27,代码来源:lib.php
示例12: instance_config_form
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))));
}
开发者ID:rboyatt,项目名称:mahara,代码行数:7,代码来源:lib.php
示例13: render_instance
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');
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:35,代码来源:lib.php
示例14: instance_config_form
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;
}
开发者ID:rboyatt,项目名称:mahara,代码行数:9,代码来源:lib.php
示例15: override_instance_title
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));
}
开发者ID:vohung96,项目名称:mahara,代码行数:9,代码来源:lib.php
示例16: instance_config_form
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;
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:9,代码来源:lib.php
示例17: get_artefacts
/**
* 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;
}
开发者ID:Br3nda,项目名称:mahara,代码行数:17,代码来源:lib.php
示例18: render_instance
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');
}
开发者ID:povsod,项目名称:mahara-blocktype-linkedinprofile,代码行数:10,代码来源:lib.php
示例19: instance_config_form
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;
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:10,代码来源:lib.php
示例20: render_instance
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');
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:11,代码来源:lib.php
注:本文中的BlockInstance类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论