/**
  */
 function tx_rnbase_model_media($rowOrUid)
 {
     if (is_object($rowOrUid)) {
         // Das Media-Objekt auslesen
         $this->initMedia($rowOrUid);
     } else {
         parent::tx_rnbase_model_base($rowOrUid);
     }
     $this->initAdditionalData();
 }
 public static function getAddLocalizationLinks(tx_rnbase_model_base $item, tx_rnbase_mod_BaseModule $mod = NULL)
 {
     if ($item->getUid() != $item->getProperty('uid') || $item->getSysLanguageUid() !== 0) {
         return '';
     }
     $out = '';
     foreach (self::getLangRecords($item->getPid()) as $lang) {
         // skip, if the be user hase no access to for the language!
         if (!$GLOBALS['BE_USER']->checkLanguageAccess($lang['uid'])) {
             continue;
         }
         // skip, if a overlay for this language allready exists
         tx_rnbase::load('tx_rnbase_util_TCA');
         $parentField = tx_rnbase_util_TCA::getTransOrigPointerFieldForTable($item->getTableName());
         $sysLanguageUidField = tx_rnbase_util_TCA::getLanguageFieldForTable($item->getTableName());
         $overlays = tx_rnbase_util_DB::doSelect('uid', $item->getTableName(), array('where' => implode(' AND ', array($parentField . '=' . $item->getUid(), $sysLanguageUidField . '=' . (int) $lang['uid'])), 'limit' => 1));
         if (!empty($overlays)) {
             continue;
         }
         /* @var $mod tx_rnbase_mod_BaseModule */
         if (!$mod instanceof tx_rnbase_mod_BaseModule) {
             $mod = $GLOBALS['SOBE'];
         }
         $onclick = $mod->getDoc()->issueCommand('&cmd[' . $item->getTableName() . '][' . $item->getUid() . '][localize]=' . $lang['uid']);
         $onclick = 'window.location.href=\'' . $onclick . '\'; return false;';
         $out .= sprintf('<a href="#" onclick="%1$s">%2$s</a>', htmlspecialchars($onclick), self::getLangSpriteIcon($lang, array('show_title' => FALSE)));
     }
     return $out;
 }
 /**
  *
  * @param tx_rnbase_model_base $item
  * @param tx_rnbase_util_FormTool $formTool
  * @param array $options
  * @return string
  */
 public function makeLink(tx_rnbase_model_base $item, tx_rnbase_util_FormTool $formTool, $options = array())
 {
     $out = $formTool->createSubmit('showDetails[' . $this->identifier . '][' . $item->getUid() . ']', isset($options['label']) ? $options['label'] : '###LABEL_SHOW_DETAILS###', isset($options['confirm']) ? $options['confirm'] : '', $options);
     return $out;
 }
 /**
  * Delete one model
  *
  * Overwrite this method to specify a specialised method signature,
  * and just call THIS method via parent::handleDelete().
  * Additionally, the deriving implementation may perform further checks etc.
  *
  * @param tx_rnbase_model_base	$model		This model is being updated.
  * @param string				$where		Override default restriction by defining an explicite where clause
  * @param int					$mode		Deletion mode with the following options: 0: Hide record; 1: Soft-delete (via "deleted" field) record; 2: Really DELETE record.
  * @param int					$table		Wenn eine Tabelle angegeben wird, wird die des Models missachtet (wichtig für temp anzeigen)
  * @return tx_rnbase_model_base				Updated (on success actually empty) model.
  */
 public function handleDelete(tx_rnbase_model_base $model, $where = '', $mode = 0, $table = null)
 {
     if (empty($table)) {
         $table = $model->getTableName();
     }
     $uid = $model->getUid();
     if (!$where) {
         $where = '1=1 AND `' . $table . '`.`uid`=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($uid, $table);
     }
     $this->delete($table, $where, $mode);
     $model->reset();
     return $model;
 }
 /**
  *
  * @param string $output
  * @return string
  */
 protected function wrapValue($output, $value, $colName, $record, tx_rnbase_model_base $item)
 {
     $stateClass = array();
     if ($item->isHidden()) {
         $stateClass[] = 'ef-hidden';
     }
     if ($item->isDeleted()) {
         $stateClass[] = 'ef-deleted';
     }
     if (!empty($stateClass)) {
         $output = '<div class="' . implode(' ', $stateClass) . '">' . $output . '</div>';
     }
     return $output;
 }
 public function test_magiccall()
 {
     $model = new tx_rnbase_model_base(array('uid' => 1, 'test_value' => 45));
     $this->assertEquals(45, $model->getTestValue());
 }
예제 #7
0
 /**
  * Most model-classes will be initialized by a uid or a database record. So
  * this is a common contructor.
  *
  * @param array|int $rowOrUid
  * @param string $tableName
  */
 public function __construct($rowOrUid, $tableName = 0)
 {
     parent::__construct($rowOrUid);
     $this->setTableName($tableName);
 }