Exemplo n.º 1
0
         if ($message == "201") {
             $addExerciseTypeNotifications[] = MakeNotification("success", Language::Get('main', 'successCreateType', $langTemplate));
         } else {
             $addExerciseTypeNotifications[] = MakeNotification("error", Language::Get('main', 'errorSaveSettings', $langTemplate));
         }
     } else {
         $addExerciseTypeNotifications[] = MakeNotification("error", Language::Get('main', 'missingFields', $langTemplate));
     }
 } elseif ($_POST['action'] == "EditExerciseType") {
     // check if POST data is send
     if (isset($_POST['exerciseTypeID']) && isset($_POST['exerciseTypeName'])) {
         // clean Input
         $exerciseTypeID = cleanInput($_POST['exerciseTypeID']);
         $exerciseTypeName = cleanInput($_POST['exerciseTypeName']);
         // create new exerciseType
         $data = ExerciseType::encodeExerciseType(ExerciseType::createExerciseType($exerciseTypeID, $exerciseTypeName));
         $url = $databaseURI . "/exercisetype/" . $exerciseTypeID;
         http_put_data($url, $data, true, $message);
         // show notification
         if ($message == "201") {
             $editExerciseTypeNotifications[] = MakeNotification("success", Language::Get('main', 'successSetType', $langTemplate));
         } else {
             $editExerciseTypeNotifications[] = MakeNotification("error", Language::Get('main', 'errorSaveSettings', $langTemplate));
         }
     } else {
         $editExerciseTypeNotifications[] = MakeNotification("error", Language::Get('main', 'missingFields', $langTemplate));
     }
 } elseif ($_POST['action'] == "GrantRights") {
     // check if POST data is send
     if (isset($_POST['userID']) && isset($_POST['Rights'])) {
         // clean Input
Exemplo n.º 2
0
 public function postSamples($callName, $input, $params = array())
 {
     set_time_limit(0);
     $sql = array();
     for ($i = 1; $i <= $params['amount']; $i++) {
         $rr = md5($i);
         $obj = ExerciseType::createExerciseType($i, $rr);
         $sql[] = "insert ignore into ExerciseType SET " . $obj->getInsertData() . ";";
         if ($i % 1000 == 0) {
             $this->_component->callSql('out2', implode('', $sql), 201, 'Model::isCreated', array(), 'Model::isProblem', array(new File()));
             $sql = array();
         }
     }
     $this->_component->callSql('out2', implode('', $sql), 201, 'Model::isCreated', array(), 'Model::isProblem', array(new File()));
     return Model::isCreated();
 }