예제 #1
0
 function AddList()
 {
     require_once ROOT_DIR . '/services/MyResearch/ListEdit.php';
     $return = array();
     if (UserAccount::isLoggedIn()) {
         $listService = new ListEdit();
         $result = $listService->addList();
         if (!PEAR_Singleton::isError($result)) {
             $return['result'] = 'Done';
             $return['newId'] = $result;
         } else {
             $error = $result->getMessage();
             if (empty($error)) {
                 $error = 'Error';
             }
             $return['result'] = translate($error);
         }
     } else {
         $return['result'] = "Unauthorized";
     }
     return json_encode($return);
 }
예제 #2
0
파일: JSON.php 프로젝트: bharatm/NDL-VuFind
 /**
  * Create new list
  *
  * @return void
  * @access public
  */
 public function addList()
 {
     include_once 'services/MyResearch/ListEdit.php';
     $user = UserAccount::isLoggedIn();
     if ($user === false) {
         return $this->output(translate('You must be logged in first'), JSON::STATUS_NEED_AUTH);
     }
     $listService = new ListEdit();
     $result = $listService->addList();
     if (PEAR::isError($result)) {
         return $this->output(translate($result->getMessage()), JSON::STATUS_ERROR);
     }
     return $this->output(array('newId' => $result), JSON::STATUS_OK);
 }