/** * Run the geocoding process. * * @param string Geocoding mode: "missing" or "all" * * @return string HTML code with geocoding results */ protected function geocode($mode) { if ($mode != 'all' && $mode != 'missing') { //wrong mode $message = new t3lib_FlashMessage('Invalid geocoding mode', '', t3lib_FlashMessage::ERROR); return $message->render(); } if ($mode == 'missing') { $where = 'tx_odsosm_lon = 0 AND tx_odsosm_lat = 0'; } else { $where = '1'; } $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_address', $where . ' AND pid = ' . $this->pObj->id); $count = 0; $updated = 0; $html = ''; while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $oldRow = $row; ++$count; if (!tx_odsosm_div::updateAddress($row)) { //not updated continue; } $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_address', 'uid = ' . intval($row['uid']), array('tx_odsosm_lat' => $row['lat'], 'tx_odsosm_lon' => $row['lon'])); $err = $GLOBALS['TYPO3_DB']->sql_error(); if ($err) { $message = new t3lib_FlashMessage('SQL error: ' . htmlspecialchars($err), '', t3lib_FlashMessage::ERROR); $html .= $message->render(); } ++$updated; } $message = new t3lib_FlashMessage('Updated ' . $updated . ' of ' . $count . ' address records', '', $updated == $count ? t3lib_FlashMessage::OK : t3lib_FlashMessage::WARNING); $html .= $message->render(); return $html . '<br/><br/>'; }
/** * Adds a message either to the BE_USER session (if the $message has the storeInSession flag set) * or it adds the message to self::$messages. * * @param object instance of t3lib_FlashMessage, representing a message * @return void */ public static function addMessage(t3lib_FlashMessage $message) { if ($message->isSessionMessage() === TRUE) { $queuedFlashMessages = self::getFlashMessagesFromSession(); $queuedFlashMessages[] = $message; $GLOBALS['BE_USER']->setAndSaveSessionData('core.template.flashMessages', $queuedFlashMessages); } else { self::$messages[] = $message; } }
/** * Adds a message either to the BE_USER session (if the $message has the storeInSession flag set) * or it adds the message to self::$messages. * * @param object instance of t3lib_FlashMessage, representing a message * @return void */ public static function addMessage(t3lib_FlashMessage $message) { if ($message->isSessionMessage()) { $queuedFlashMessages = self::getFlashMessagesFromSession(); $queuedFlashMessages[] = $message; self::storeFlashMessagesInSession($queuedFlashMessages); } else { self::$messages[] = $message; } }
/** * Output t3lib_FlashMessage * * @param t3lib_FlashMessage $message * * @return void */ public function outputMessage($message = NULL) { if ($message->getTitle()) { $this->outputLine($message->getTitle()); } if ($message->getMessage()) { $this->outputLine($message->getMessage()); } if ($message->getSeverity() !== t3lib_FlashMessage::OK) { $this->sendAndExit(1); } }
/** * @return string */ protected function showForm() { $message = new t3lib_FlashMessage( 'This action can affect ' . count($this->getAllSubPages($this->pObj->id)) . ' pages, please ensure, you know what you do!, Please backup your TYPO3 Installation before running that wizard.', '', t3lib_FlashMessage::WARNING ); $buffer = $message->render(); unset($message); $buffer .= '<form action="' . $this->getLinkModuleRoot() . '"><div id="formFieldContainer">'; $options = $this->getDSFieldOptionCode(); $buffer .= $this->addFormField('sourceField', null, 'select_optgroup', $options); $buffer .= $this->addFormField('destinationField', null, 'select_optgroup', $options); $buffer .= $this->addFormField('simulateField', 1, 'checkbox'); $buffer .= $this->addFormField('executeRename', 1, 'hidden'); $buffer .= $this->addFormField('submit', null, 'submit'); $buffer .= '</div></form>'; $this->getKnownPageDS(); return $buffer; }