function cmdFetchAlbums($pParamHash) { require_once FISHEYE_PKG_PATH . 'FisheyeGallery.php'; global $gBitUser; if ($gBitUser->isRegistered()) { $treeGallery = new FisheyeGallery(); $listHash['user_id'] = $gBitUser->mUserId; if ($galleryList = $treeGallery->getTree($listHash, array('name' => "gallery_id", 'id' => "gallerylist", 'item_attributes' => array('class' => 'listingtitle')))) { $galResponse = array(); $galleryCount = $this->traverseGalleries($galleryList, $galResponse); $galResponse['album_count'] = $galleryCount; $galResponse['can_create_root'] = 'true'; $response = $this->createResponse(FEG2REMOTE_SUCCESS, 'Gallery list successful', $galResponse); } else { // perhaps we should make at least on gallery at this point? $response = $this->createResponse(FEG2REMOTE_SUCCESS, 'No galleries', array('album_count' => 0)); } } else { $response = $this->createResponse(FEG2REMOTE_PASSWORD_WRONG, 'Application not logged in'); } return $response; }
function generateMenu($pListHash, $pOptions, $pLocate = NULL) { $ret = "<select class='form-control' "; foreach (array('class', 'name', 'id', 'onchange') as $key) { if (!empty($pOptions[$key])) { $ret .= " {$key}=\"{$pOptions[$key]}\" "; } } $ret .= ">"; $ret .= !empty($pOptions['first_option']) ? $pOptions['first_option'] : ''; if ($hash = FisheyeGallery::getTree($pListHash)) { $ret .= FisheyeGallery::generateMenuOptions($hash, $pOptions, $pLocate); } $ret .= "</select>"; return $ret; }