Beispiel #1
0
 /**
  * Make the pagination links for a registered Xajax class method
  *
  * @param integer $nItemsTotal the total number of items
  * @param integer $nItemsPerPage the number of items per page page
  * @param integer $nCurrentPage the current page
  * @param string  $sMethod the name of function or a method prepended with its class name
  * @param ... $parameters the parameters of the method
  *
  * @return string the pagination links
  */
 public static function paginate($nItemsTotal, $nItemsPerPage, $nCurrentPage, $sMethod)
 {
     // Get the args list starting from the $sMethod
     $aArgs = array_slice(func_get_args(), 3);
     // Make the request
     $request = call_user_func_array('self::call', $aArgs);
     $paginator = Container::getInstance()->getPaginator();
     $paginator->setup($nItemsTotal, $nItemsPerPage, $nCurrentPage, $request);
     return $paginator->toHtml();
 }
Beispiel #2
0
/**
 * Translate a text to the selected language
 *
 * @param string        $sText                The text to translate
 * @param array            $aPlaceHolders        The placeholders in the text
 * @param string        $sLanguage            The language to translate to
 *
 * @return string
 */
function xajax_trans($sText, array $aPlaceHolders = array(), $sLanguage = null)
{
    return \Xajax\Utils\Container::getInstance()->getTranslator()->trans($sText, $aPlaceHolders, $sLanguage);
}
Beispiel #3
0
 private function __construct()
 {
     $this->aProcessingEvents = array();
     $sTranslationDir = realpath(__DIR__ . '/../translations');
     $sTemplateDir = realpath(__DIR__ . '/../templates');
     Utils\Container::getInstance()->init($sTranslationDir, $sTemplateDir);
     $this->xRequestManager = RequestManager::getInstance();
     $this->xResponseManager = ResponseManager::getInstance();
     $this->xPluginManager = PluginManager::getInstance();
     $this->setDefaultOptions();
     $this->aOptionMappings = array('language' => 'core.language', 'version' => 'core.version', 'characterEncoding' => 'core.encoding', 'decodeUTF8Input' => 'core.decode_utf8', 'requestURI' => 'core.request.uri', 'defaultMode' => 'core.request.mode', 'defaultMethod' => 'core.request.method', 'wrapperPrefix' => array('core.prefix.function', 'core.prefix.class'), 'eventPrefix' => 'core.prefix.event', 'timeout' => 'core.process.timeout', 'cleanBuffer' => 'core.process.clean_buffer', 'exitAllowed' => 'core.process.exit_after', 'errorHandler' => 'core.error.handle', 'logFile' => 'core.error.log_file', 'debug' => 'core.debug.on', 'verboseDebug' => 'core.debug.verbose', 'debugOutputID' => 'js.lib.output_id', 'responseQueueSize' => 'js.lib.queue_size', 'scriptLoadTimeout' => 'js.lib.load_timeout', 'waitCursor' => 'js.lib.show_cursor', 'statusMessages' => 'js.lib.show_status', 'javascript URI' => array('js.app.uri', 'js.lib.uri'), 'javascript Dir' => 'js.app.dir', 'deferScriptGeneration' => array('js.app.export', 'js.app.minify'), 'deferDirectory' => 'js.app.dir', 'scriptDefferal' => 'js.app.options');
 }