function execute($request)
 {
     parent::execute($request);
     // makecontent/contentmanager
     $page = empty($request['makecontent']) ? 'contentmanager' : 'makecontent';
     // $contentObj
     $contentObj = new PicoContent($this->mydirname, $request['content_id'], $this->currentCategoryObj, $page == 'makecontent');
     // check existence
     if ($contentObj->isError()) {
         redirect_header(XOOPS_URL . "/modules/{$this->mydirname}/index.php", 2, _MD_PICO_ERR_READCONTENT);
         exit;
     }
     // fetch data from DB
     $cat_data = $this->currentCategoryObj->getData();
     $this->assign['category'] = $this->currentCategoryObj->getData4html();
     $content_data = $contentObj->getData();
     $this->assign['content_base'] = $contentObj->getData4html(true);
     $this->contentObjs['content_base'] =& $contentObj;
     $this->assign['content'] = $contentObj->getData4edit();
     // permission check
     if ($page == 'makecontent') {
         if (empty($cat_data['can_post'])) {
             redirect_header(XOOPS_URL . '/', 2, _MD_PICO_ERR_CREATECONTENT);
         }
     } else {
         if (empty($content_data['can_edit'])) {
             redirect_header(XOOPS_URL . '/', 2, $content_data['locked'] ? _MD_PICO_ERR_LOCKEDCONTENT : _MD_PICO_ERR_EDITCONTENT);
         }
     }
     // category list can be read for category jumpbox etc.
     $categoryHandler = new PicoCategoryHandler($this->mydirname, $this->permissions);
     $categories = $categoryHandler->getAllCategories();
     $this->assign['categories_can_post'] = array();
     foreach ($categories as $tmpObj) {
         $tmp_data = $tmpObj->getData();
         if (empty($tmp_data['can_post']) && empty($tmp_data['can_edit'])) {
             continue;
         }
         $this->assign['categories_can_post'][$tmp_data['id']] = str_repeat('--', $tmp_data['cat_depth_in_tree']) . $tmp_data['cat_title'];
     }
     // vpath options
     $this->assign['content']['wraps_files'] = array('' => '---') + pico_main_get_wraps_files_recursively($this->mydirname, '/');
     // breadcrumbs
     $breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
     if ($page == 'makecontent') {
         $breadcrumbsObj->appendPath('', _MD_PICO_LINK_MAKECONTENT);
         $this->assign['xoops_pagetitle'] = _MD_PICO_LINK_MAKECONTENT;
     } else {
         $breadcrumbsObj->appendPath(XOOPS_URL . '/modules/' . $this->mydirname . '/' . $this->assign['content']['link'], $this->assign['content']['subject']);
         $breadcrumbsObj->appendPath('', _MD_PICO_CONTENTMANAGER);
         $this->assign['xoops_pagetitle'] = _MD_PICO_CONTENTMANAGER;
     }
     $this->assign['xoops_breadcrumbs'] = $breadcrumbsObj->getXoopsbreadcrumbs();
     // misc assigns
     $this->assign['content_histories'] = pico_get_content_histories4assign($this->mydirname, $content_data['id']);
     $this->assign['page'] = $page;
     $this->assign['formtitle'] = $page == 'makecontent' ? _MD_PICO_LINK_MAKECONTENT : _MD_PICO_LINK_EDITCONTENT;
     $this->assign['gticket_hidden'] = $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'pico');
     // views
     $this->template_name = $this->mydirname . '_main_content_form.html';
     $this->is_need_header_footer = true;
     // preview
     $this->processPreview($request);
     // editor (wysiwyg etc)
     $editor_assigns = $this->getEditorAssigns('body', $this->assign['content']['body_raw']);
     $this->assign['body_wysiwyg'] = $editor_assigns['body'];
     $this->html_header .= $editor_assigns['header'];
 }
    }
    redirect_header(XOOPS_URL . "/modules/{$mydirname}/admin/index.php?page=contents&cat_id={$cat_id}", 3, _MD_A_PICO_MSG_CONTENTSEXPORTED);
    exit;
}
//
// form stage
//
// category options as array
$cat_options = pico_common_get_cat_options($mydirname);
// fetch contents
if ($cat_id == SPECIAL_CAT_ID_DELETED) {
    $ors = $db->query("SELECT oh.*,up.uname AS poster_uname,um.uname AS modifier_uname,c.cat_title,c.cat_depth_in_tree,1 AS is_deleted  FROM " . $db->prefix($mydirname . "_content_histories") . " oh LEFT JOIN " . $db->prefix("users") . " up ON oh.poster_uid=up.uid LEFT JOIN " . $db->prefix("users") . " um ON oh.modifier_uid=um.uid LEFT JOIN " . $db->prefix($mydirname . "_categories") . " c ON oh.cat_id=c.cat_id LEFT JOIN " . $db->prefix($mydirname . "_contents") . " o ON o.content_id=oh.content_id WHERE o.content_id IS NULL GROUP BY oh.content_id ORDER BY oh.modified_time DESC");
} else {
    $whr_cat_id = $cat_id == SPECIAL_CAT_ID_ALL ? "1" : "o.cat_id={$cat_id}";
    $ors = $db->query("SELECT o.*,up.uname AS poster_uname,um.uname AS modifier_uname,c.cat_title,c.cat_depth_in_tree,0 AS is_deleted  FROM " . $db->prefix($mydirname . "_contents") . " o LEFT JOIN " . $db->prefix("users") . " up ON o.poster_uid=up.uid LEFT JOIN " . $db->prefix("users") . " um ON o.modifier_uid=um.uid LEFT JOIN " . $db->prefix($mydirname . "_categories") . " c ON o.cat_id=c.cat_id WHERE ({$whr_cat_id}) ORDER BY c.cat_depth_in_tree,o.weight,o.content_id");
}
$contents4assign = array();
while ($content_row = $db->fetchArray($ors)) {
    $wrap_full_path = XOOPS_TRUST_PATH . _MD_PICO_WRAPBASE . '/' . $mydirname . str_replace('..', '', $content_row['vpath']);
    $content4assign = array('id' => intval($content_row['content_id']), 'link' => pico_common_make_content_link4html($xoopsModuleConfig, $content_row), 'cat_title' => $myts->makeTboxData4Show($content_row['cat_title'], 1, 1), 'created_time_formatted' => formatTimestamp($content_row['created_time'], 'm'), 'modified_time_formatted' => formatTimestamp($content_row['modified_time'], 'm'), 'expiring_time_formatted' => formatTimestamp(@$content_row['expiring_time'], 'm'), 'poster_uname' => $content_row['poster_uid'] ? $myts->makeTboxData4Show($content_row['poster_uname']) : _MD_PICO_REGISTERED_AUTOMATICALLY, 'modifier_uname' => $content_row['modifier_uid'] ? $myts->makeTboxData4Show($content_row['modifier_uname']) : _MD_PICO_REGISTERED_AUTOMATICALLY, 'subject' => $myts->makeTboxData4Edit($content_row['subject']), 'vpath' => htmlspecialchars($content_row['vpath']), 'wrap_file' => is_file($wrap_full_path) ? array('mtime_formatted' => formatTimestamp(filemtime($wrap_full_path), 'm'), 'size' => filesize($wrap_full_path)) : false, 'histories' => $content_row['is_deleted'] ? pico_get_content_histories4assign($mydirname, intval($content_row['content_id'])) : array(), 'ef' => pico_common_unserialize($content_row['extra_fields']));
    $contents4assign[] = $content4assign + $content_row;
}
//
// display stage
//
xoops_cp_header();
include dirname(__FILE__) . '/mymenu.php';
$tpl =& new XoopsTpl();
$tpl->assign(array('mydirname' => $mydirname, 'mod_name' => $xoopsModule->getVar('name'), 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $xoopsModuleConfig['images_dir'], 'mod_config' => $xoopsModuleConfig, 'cat_id' => $cat_id, 'cat_link' => pico_common_make_category_link4html($xoopsModuleConfig, $cat_id, $mydirname), 'cat_title' => htmlspecialchars($cat_title, ENT_QUOTES), 'cat_options' => $cat_options + array(SPECIAL_CAT_ID_ALL => _MD_PICO_ALLCONTENTS, SPECIAL_CAT_ID_DELETED => _MD_PICO_DELETEDCONTENTS), 'cat_options4move' => $cat_options, 'module_options' => $exportable_modules, 'contents' => $contents4assign, 'gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'pico_admin')));
$tpl->display('db:' . $mydirname . '_admin_contents.html');
xoops_cp_footer();
Esempio n. 3
0
while( $content_row = $db->fetchArray( $ors ) ) {
	$wrap_full_path = XOOPS_TRUST_PATH._MD_PICO_WRAPBASE.'/'.$mydirname.str_replace('..','',$content_row['vpath']) ;

	$content4assign = array(
		'id' => intval( $content_row['content_id'] ) ,
		'link' => pico_common_make_content_link4html( $xoopsModuleConfig , $content_row ) ,
		'cat_title' => $myts->makeTboxData4Show( $content_row['cat_title'] , 1 , 1 ) ,
		'created_time_formatted' => formatTimestamp( $content_row['created_time'] , 'm' ) ,
		'modified_time_formatted' => formatTimestamp( $content_row['modified_time'] , 'm' ) ,
		'expiring_time_formatted' => formatTimestamp( @$content_row['expiring_time'] , 'm' ) ,
		'poster_uname' => $content_row['poster_uid'] ? $myts->makeTboxData4Show( $content_row['poster_uname'] ) : _MD_PICO_REGISTERED_AUTOMATICALLY ,
		'modifier_uname' => $content_row['modifier_uid'] ? $myts->makeTboxData4Show( $content_row['modifier_uname'] ) : _MD_PICO_REGISTERED_AUTOMATICALLY ,
		'subject' => $myts->makeTboxData4Edit( $content_row['subject'] ) ,
		'vpath' => htmlspecialchars( $content_row['vpath'] ) ,
		'wrap_file' => is_file( $wrap_full_path ) ? array( 'mtime_formatted' => formatTimestamp( filemtime( $wrap_full_path ) , 'm' ) , 'size' => filesize( $wrap_full_path ) ) : false ,
		'histories' => $content_row['is_deleted'] ? pico_get_content_histories4assign( $mydirname , intval( $content_row['content_id'] ) ) : array() ,
		'ef' => pico_common_unserialize( $content_row['extra_fields'] ) ,
	) ;
	$contents4assign[] = $content4assign + $content_row ;
}


//
// display stage
//

xoops_cp_header();
include dirname(__FILE__) . '/mymenu.php';
$tpl = new XoopsTpl() ;
$tpl->assign( array(
	'mydirname' => $mydirname ,