Пример #1
0
 /**
  * Returns a reference to the a Table object, always creating it
  *
  * @param type $type The table type to instantiate
  * @param string A prefix for the table class name
  * @return database A database object
  * @since 1.5
  */
 function &getInstanceAutofields($type, $prefix, $table, $key = 'id', $defaults = array())
 {
     $type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
     $tableClass = $prefix . ucfirst($type);
     if (!class_exists($tableClass)) {
         jimport('joomla.filesystem.path');
         if ($path = JPath::find(RdbsTable::addIncludePath(), strtolower($type) . '.php')) {
             require_once $path;
             if (!class_exists($tableClass)) {
                 $tableClass = 'RdbsTable';
             }
         } else {
             $tableClass = 'RdbsTable';
         }
     }
     $db =& RdbsFactory::getDBO();
     $instance = new $tableClass($table, $key, $db);
     $instance->setDBO($db);
     // get the table properties
     $result = $db->getTableFields(array($table));
     $fields = $result[$table];
     foreach ($fields as $key => $val) {
         if (count($defaults) != 0 and array_key_exists($key, $defaults)) {
             $instance->set($key, $defaults[$key]);
         } else {
             if (strpos($val, 'int') === false and strpos($val, 'float') === false) {
                 $instance->set($key, '');
             } else {
                 $instance->set($key, 0);
             }
         }
     }
     return $instance;
 }
Пример #2
0
 /**
  * wrapper method for setting the page title
  *
  * @param string $title
  */
 public function setPageTitle($title, $append = false, $appendString = ': ')
 {
     $doc = RdbsFactory::getDocument();
     $newtitle = $append ? $doc->getTitle() . $appendString . $title : $title;
     $doc->setTitle($newtitle);
 }
Пример #3
0
 /**
  * Constructor
  * @param $args
  * @return unknown_type
  */
 function __construct($args = array())
 {
     parent::__construct($args);
     // get the database handle from the model
     if (array_key_exists('db', $args)) {
         $this->db = $args['db'];
     } else {
         $this->db = $this->getDBO();
     }
     // get the objname from the model
     if (array_key_exists('objname', $args)) {
         $this->objname = $args['objname'];
     } else {
         $this->objname = $this->getName();
     }
     // get a appplication object
     $this->app = RdbsFactory::getApplication();
     // get application name
     if (array_key_exists('scope', $args)) {
         $this->scope = $args['scope'];
     } else {
         $this->scope = $this->app->scope;
     }
     // set content
     if (array_key_exists('context', $args)) {
         $this->context = $args['context'];
     } else {
         $this->context = $this->scope . '.' . $this->objname . '.';
     }
     // set tablename for model
     if (array_key_exists('table', $args)) {
         $this->table = $args['table'];
     } else {
         $this->table = '#__' . substr($this->scope, 4) . '_' . $this->objname;
     }
 }
Пример #4
0
/**
 * RD REGISTER
 * @author Robert Deutz (email contact@rdbs.net / site www.rdbs.de)
 * @version $Id: gmap.php 9 2010-04-26 18:46:55Z deutz $
 * @package RD_REGISTER
 * @copyright Copyright (C) 2008 Robert Deutz Business Solution
 * @license Commercial Licence
 **/
if (!defined('RDEVENT')) {
    die('Restricted access1');
}
// apikey pr-journal.de key=ABQIAAAAX9uuFjIcmqRH4GMy_b5a1RQj0wH8U3Ifp_c5clJXMcjVM0SJchQAp5mRSwiK1bl-YCmOtlZJkz0fPw
// apikey datenbanken.pr-journal.de key=ABQIAAAAX9uuFjIcmqRH4GMy_b5a1RSD23nydTvfmFHHPcm_bwvjyM6z3RQLcDrUlrbAhGrCja7byDTjTX4Iag
$row = $this->element;
if ($row->geo_b != '' && $row->geo_l != '') {
    $doc = RdbsFactory::getDocument();
    $surl = "http://www.google.com/jsapi?key=" . $this->sconf->get('gmapappkey');
    $doc->addScript($surl);
    $script = '
	  google.load("maps", "2");
	   
	  // Diese Funktion aufrufen, wenn die Seite geladen ist
	  function initialize() {
	    var map = new google.maps.Map2(document.getElementById("map"));
	    map.setCenter(new google.maps.LatLng( ' . $row->geo_b . ', ' . $row->geo_l . '), ' . $this->sconf->get('gmapdefzoom', 14) . ');
	    
		var point = new GLatLng(' . $row->geo_b . ', ' . $row->geo_l . ');
	    map.addOverlay(new GMarker(point));    
	    
	  }
	  google.setOnLoadCallback(initialize);
Пример #5
0
 function checkoutProcessing($row, $rownum = 0, $resulttype = 'boolean', $overlib = 1, $checkoutfield = 'checked_out', $identifier = 'id', $formfield = 'cid')
 {
     $user =& RdbsFactory::getUser();
     $userid = $user->get('id');
     $checkout = false;
     // check member
     if (property_exists($row, $checkoutfield)) {
         if (!($row->{$checkoutfield} == $userid || $row->{$checkoutfield} == 0)) {
             $checkout = true;
         }
     }
     if ($resulttype == 'boolean') {
         return $checkout;
     } else {
         // return html code to display
         if ($checkout) {
             $checkoutByUserId = $row->{$checkoutfield};
             $user->load($checkoutByUserId);
             $name = $user->name;
             $hover = '';
             if ($overlib) {
                 $text = ':: ' . addslashes(htmlspecialchars($name));
                 $date = '';
                 $time = '';
                 if (property_exists($row, 'checked_out_time')) {
                     $date = RdbsHTML::_('date', $row->checked_out_time, '%A, %d %B %Y') . ' ';
                     $time = RdbsHTML::_('date', $row->checked_out_time, '%H:%M');
                 }
                 $hover = '<span class="editlinktip hasTip" title="' . RdbsText::_('Checked Out') . $text . ' ' . $date . $time . '">';
             }
             $hover = $hover . '<img src="images/checked_out.png"/></span>';
             return $hover;
         } else {
             return '<input type="checkbox" id="cb' . $rownum . '" name="' . $formfield . '[]" value="' . $row->{$identifier} . '" onclick="isChecked(this.checked);" />';
         }
     }
 }