本文整理汇总了PHP中ArtefactTypeFileBase::get_switch_width方法的典型用法代码示例。如果您正苦于以下问题:PHP ArtefactTypeFileBase::get_switch_width方法的具体用法?PHP ArtefactTypeFileBase::get_switch_width怎么用?PHP ArtefactTypeFileBase::get_switch_width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArtefactTypeFileBase
的用法示例。
在下文中一共展示了ArtefactTypeFileBase::get_switch_width方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pieform_element_filebrowser_build_filelist
function pieform_element_filebrowser_build_filelist($form, $element, $folder, $highlight = null, $user = null, $group = null, $institution = null)
{
require_once 'license.php';
if (!$form->submitted_by_js()) {
// We're going to rebuild the page from scratch anyway.
return;
}
global $USER;
$smarty = smarty_core();
$userid = null;
if (is_null($institution) && is_null($group) && is_null($user)) {
// See if the filebrowser has indicated it's a group element
if (!empty($element['group'])) {
$group = $element['group'];
} else {
// otherwise check if the form knows it's in a group setting
$group = $form->get_property('group');
}
// See if the filebrowser has indicated it's an institution element
if (!empty($element['institution'])) {
$institution = $element['institution'];
} else {
// otherwise check if the form knows it's in an institution setting
$institution = $form->get_property('institution');
}
$userid = $group || $institution ? null : $USER->get('id');
}
if ($user) {
$userid = $USER->get('id');
$smarty->assign('owner', 'user');
$smarty->assign('ownerid', $userid);
} else {
if ($institution) {
$smarty->assign('owner', 'institution');
$smarty->assign('ownerid', $institution);
} else {
$smarty->assign('owner', 'group');
$smarty->assign('ownerid', $group);
}
}
$editable = (int) $element['config']['edit'];
$selectable = (int) $element['config']['select'];
$selectfolders = (int) (!empty($element['config']['selectfolders']));
$publishing = (int) (!empty($element['config']['publishing']));
$showtags = !empty($element['config']['tag']) ? (int) $userid : 0;
$editmeta = (int) ($userid && !$editable && !empty($element['config']['tag']));
$querybase = $element['page'] . (strpos($element['page'], '?') === false ? '?' : '&');
$prefix = $form->get_name() . '_' . $element['name'];
$filters = isset($element['filters']) ? $element['filters'] : null;
$filedata = ArtefactTypeFileBase::get_my_files_data($folder, $userid, $group, $institution, $filters);
$switchwidth = ArtefactTypeFileBase::get_switch_width();
$smarty->assign('edit', -1);
$smarty->assign('highlight', $highlight);
$smarty->assign('editable', $editable);
$smarty->assign('selectable', $selectable);
$smarty->assign('selectfolders', $selectfolders);
$smarty->assign('publishing', $publishing);
$smarty->assign('showtags', $showtags);
$smarty->assign('editmeta', $editmeta);
$smarty->assign('filelist', $filedata);
$smarty->assign('switchwidth', $switchwidth);
$smarty->assign('querybase', $querybase);
$smarty->assign('prefix', $prefix);
$params = 'folder=' . ($folder === null ? 0 : $folder);
if ($group !== null) {
$params .= '&group=' . $group;
}
if ($institution !== null) {
$params .= '&institution=' . $institution;
}
$smarty->assign('folderparams', $params);
return array('data' => $filedata, 'html' => $smarty->fetch('artefact:file:form/filelist.tpl'));
}