function template_preprocess_filedepot_activefolder in filedepot 7
Same name and namespace in other branches
- 6 lib-theme.php \template_preprocess_filedepot_activefolder()
File
- ./
lib-theme.php, line 171 - lib-theme.php Theme support functions for the module
Code
function template_preprocess_filedepot_activefolder(&$variables) {
$filedepot = filedepot_filedepot();
$variables['show_activefolder'] = 'none';
$variables['show_reportmodeheader'] = 'none';
$variables['show_nonadmin'] = 'none';
$variables['show_breadcrumbs'] = 'none';
$variables['folder_breadcrumb_links'] = '';
$variables['report_heading'] = '';
$variables['active_folder_admin'] = '';
if ($filedepot->cid == 0) {
if (in_array($filedepot->activeview, $filedepot->validReportingModes)) {
if ($filedepot->activeview == 'search') {
$variables['report_heading'] = t("@active returned %count records", array(
"@active" => $filedepot->activeview,
"%count" => $filedepot->recordCount,
));
}
else {
$variables['report_heading'] = t("@active", array(
"@active" => $filedepot->activeview,
));
}
$variables['show_reportmodeheader'] = '';
}
}
else {
$variables['show_activefolder'] = '';
$pid = db_query("SELECT pid FROM {filedepot_categories} WHERE cid=:cid", array(
':cid' => $filedepot->cid,
))
->fetchField();
if ($pid != 0) {
$parent = $pid;
$rootfolder = $filedepot->cid;
while ($parent != 0) {
// Determine the rootfolder
$rootfolder = $parent;
$parent = db_query("SELECT pid FROM {filedepot_categories} WHERE cid=:cid", array(
':cid' => $parent,
))
->fetchField();
}
$variables['folder_breadcrumb_links'] = theme('filedepot_folder_breadcrumb', array(
'cid' => $rootfolder,
'padding' => 0,
));
if ($rootfolder != $pid) {
$query = db_query("SELECT cid from {filedepot_categories} WHERE cid=:cid", array(
':cid' => $pid,
));
$A = $query
->fetchAssoc();
$variables['folder_breadcrumb_links'] .= theme('filedepot_folder_breadcrumb', array(
'cid' => $A['cid'],
'padding' => 5,
));
}
$variables['show_breadcrumbs'] = 'block';
}
if ($filedepot
->checkPermission($filedepot->cid, 'admin')) {
$variables['active_folder_admin'] = theme('filedepot_activefolder_admin', array(
'token' => $variables['token'],
));
}
else {
$variables['show_nonadmin'] = '';
$variables['active_folder_admin'] = theme('filedepot_activefolder_nonadmin');
}
}
$variables['ajaxstatus'] = theme('filedepot_ajaxstatus');
$variables['ajaxactivity'] = theme('filedepot_ajaxactivity', array(
'layout_url' => $variables['layout_url'],
));
}