public function GET($PARAMn) { $PARSEARR = json_decode($PARAMn, true); // Decode raw post to array //$PARSEARR['params']['device'] = "logan"; //$PARSEARR['params']['source_incremental']=""; if ($PARSEARR == true) { // If decode ok if (isset($PARSEARR['params']['device']) and isset($PARSEARR['params']['source_incremental'])) { // If we want all builds list for device $this->AR['LOG']->WR("OTAClass: ALL BUILD"); $DEVICE = $PARSEARR['params']['device']; // Get device name from post $this->AR['LOG']->WR("OTAClass: ALL BUILD device = " . $DEVICE . ""); $this->AR['LOG']->WR("OTAClass: ALL BUILD source_incremental = " . $PARSEARR['params']['source_incremental'] . ""); $RAWNEW = OTA_GET_API($DEVICE, 0, NULL, $this->AR); // GEt from sql all build if ($RAWNEW) { $this->OTAREL .= $this->composerOTA($RAWNEW); // Create build $this->AR['LOG']->WR($this->OTAREL); } else { // No builds for device $this->AR['LOG']->WR("OTAClass: NO BUILDS FOR DEVICE " . $DEVICE . ""); $this->OTAREL = $this->TPLw['OTA_NULL']; // Send null } } if (isset($PARSEARR['target_incremental'])) { // Get one build $this->AR['LOG']->WR("OTAClass: GET " . $PARSEARR['target_incremental'] . ""); $HBUILD = $PARSEARR['target_incremental']; // Get need build $RAWB = OTA_GET_API($HBUILD, 1, NULL, $this->AR); // Get one build if ($RAWB) { // if ok $this->OTAREL .= $this->composerOTA($RAWB); // Create $this->AR['LOG']->WR($this->OTAREL); } else { $this->AR['LOG']->WR("OTAClass: CREATE() NO BUILD " . $HBUILD . ""); $this->OTAREL .= $this->TPLw['OTA_NULL']; } } } else { $this->AR['LOG']->WR("OTAClass: ERROR decode RAW post"); $this->OTAREL = $this->TPLw['OTA_NULL']; // Send null } }
private function paginationcomposer($CUR_PAGE) { $EXT['STNEWS'] = 0; // Start news $EXT['PPAGENEWS'] = 0; // End news $ALLNEWSCNT = OTA_GET_API("", 3, $EXT, $this->AR); // All news(no limit) $PAGE_ALL = ceil($ALLNEWSCNT / $this->CONF['NEWS_OTA_PERPAGE']); // How page we hawe if ($CUR_PAGE < 1) { // if current page < 1 $CUR_PAGE = 1; // Set current page 1 } if ($CUR_PAGE > $PAGE_ALL and $ALLNEWSCNT != 0) { // $CUR_PAGE = $PAGE_ALL; // } if ($ALLNEWSCNT) { $PG_LNK = "?page"; $this->FIRSTNav($this->TPLw['PAGINATION'], $CUR_PAGE, $PG_LNK); // $this->PREVNav($this->TPLw['PAGINATION'], $CUR_PAGE, $PG_LNK); // $this->CURNav($this->TPLw['PAGINATION'], $CUR_PAGE, $PG_LNK); // $this->NEXTNav($this->TPLw['PAGINATION'], $CUR_PAGE, $PG_LNK, $PAGE_ALL); // $this->LASTNav($this->TPLw['PAGINATION'], $CUR_PAGE, $PG_LNK, $PAGE_ALL); // } $START_NEWS = ($CUR_PAGE - 1) * $this->CONF['NEWS_OTA_PERPAGE']; // Start news for DB return $START_NEWS; }