Example #1
0
 function get_tad_gallery_block_cate($of_csn = 0, $level = 0, $v = "")
 {
     global $xoopsDB, $xoopsUser;
     $modhandler =& xoops_gethandler('module');
     $xoopsModule =& $modhandler->getByDirname("tadgallery");
     if ($xoopsUser) {
         $module_id = $xoopsModule->getVar('mid');
         $isAdmin = $xoopsUser->isAdmin($module_id);
     } else {
         $isAdmin = false;
     }
     $sql = "select count(*),csn from " . $xoopsDB->prefix("tad_gallery") . " group by csn";
     $result = $xoopsDB->query($sql);
     while (list($count, $csn) = $xoopsDB->fetchRow($result)) {
         $cate_count[$csn] = $count;
     }
     //$left=$level*10;
     $level += 1;
     $syb = str_repeat("-", $level) . " ";
     $option = $of_csn ? "" : "<option value='0'>" . _MB_TADGAL_BLOCK_ALL . "</option>";
     $sql = "select csn,title from " . $xoopsDB->prefix("tad_gallery_cate") . " where of_csn='{$of_csn}' and passwd='' and enable_group='' order by sort";
     $result = $xoopsDB->query($sql);
     while (list($csn, $title) = $xoopsDB->fetchRow($result)) {
         $selected = $v == $csn ? "selected" : "";
         $count = empty($cate_count[$csn]) ? 0 : $cate_count[$csn];
         $option .= "<option value='{$csn}' {$selected}>{$syb}{$title}({$count})</option>";
         $option .= get_tad_gallery_block_cate($csn, $level, $v);
     }
     return $option;
 }
function tadgallery_cooliris_edit($options)
{
    $cate_select = get_tad_gallery_block_cate(0, 0, $options[0]);
    $include_sub = $options[1] == "1" ? "checked" : "";
    $options[2] = intval($options[2]);
    if (empty($options[2])) {
        $options[2] = '100%';
    }
    $options[3] = intval($options[3]);
    if (empty($options[3])) {
        $options[3] = '450';
    }
    $form = "\n    <div>" . _MB_TADGAL_BLOCK_SHOWCATE . "\n      <select name='options[0]'>\n        {$cate_select}\n      </select>\n      <label for='include_sub'>\n        <input type='checkbox' name='options[1]' id='include_sub' value='1' {$include_sub}>\n        " . _MB_TADGAL_BLOCK_INCLUDE_SUB_ALBUMS . "\n      </label>\n    </div>\n  <div>\n    " . _MB_TADGAL_BLOCK_WIDTH . "\n    <input type='hidden' name='options[2]' value='100%' size=3> 100% x\n    " . _MB_TADGAL_BLOCK_HEIGHT . "\n    <input type='text' name='options[3]' value='{$options[3]}' size=3> px\n  </div>\n  ";
    return $form;
}