/** * Retrieves the raw new site's data from a portal request and submit it to the * services layer's site functions. * @param \User $user current user * @return null */ function submit(\User $user = null) { $newValues = getSiteDataFromWeb(); $serv = \Factory::getSiteService(); try { $site = $serv->addSite($newValues, $user); } catch (Exception $e) { show_view('error.php', $e->getMessage()); die; } $params['site'] = $site; show_view("site/submit_new_site.php", $params); die; }
/** * Processes an edit site request from a web request * @param \User $user current user * return null */ function submit(\User $user = null) { try { $newValues = getSiteDataFromWeb(); $siteId = \Factory::getSiteService()->getSite($newValues['ID']); $site = \Factory::getSiteService()->editSite($siteId, $newValues, $user); $params = array('site' => $site); show_view('site/site_updated.php', $params); } catch (Exception $e) { show_view('error.php', $e->getMessage()); die; } }