示例#1
0
 /**
  * Enter description here...
  *
  * @param unknown_type $row
  * @param unknown_type $id
  * @return unknown
  */
 public static function checkedOut($row, $id = 'sid')
 {
     $state = $row->get('cout');
     if ($state && $state != Sobi::My('id') && strtotime($row->get('coutTime')) > time()) {
         /* translate alternative text */
         $user = SPUser::getInstance($state);
         $uname = $user->get('name');
         $img = Sobi::Cfg('list_icons.checked_out');
         $s = Sobi::Txt($row->get('oType') . '.checked_out');
         $a = Sobi::Txt($row->get('oType') . '.checked_out_by', array('user' => $uname, 'time' => $row->get('coutTime')));
         $r = SPTooltip::toolTip($a, $s, $img);
     } else {
         $sid = $row->get('id');
         $r = "<input type=\"checkbox\" name=\"{$id}[]\" value=\"{$sid}\" onclick=\"SPCheckListElement( this )\" />";
     }
     return $r;
 }
示例#2
0
 public function checkbox($cell)
 {
     /** First let's check if it is not checked out */
     if (isset($cell['attributes']['checked-out-by']) && isset($cell['attributes']['checked-out-time']) && $cell['attributes']['checked-out-by'] && $cell['attributes']['checked-out-by'] != Sobi::My('id') && strtotime($cell['attributes']['checked-out-time']) > gmdate('U')) {
         if (isset($cell['attributes']['checked-out-ico']) && $cell['attributes']['checked-out-ico']) {
             $icon = $cell['attributes']['checked-out-ico'];
         } else {
             $icon = $this->_checkedOutIcon;
         }
         $user = SPUser::getInstance($cell['attributes']['checked-out-by']);
         $txt = Sobi::Txt('CHECKED_OUT', $user->get('name'), $cell['attributes']['checked-out-time']);
         $this->_out[] = '<a href="#" rel="sp-tooltip" data-original-title="' . $txt . '" class="checkedout">';
         $this->_out[] = '<i class="icon-' . $icon . '"></i>';
         $this->_out[] = '</a>';
         return $cell;
     } elseif ($this->istSet($cell['attributes'], 'locked', true)) {
         $icon = $this->istSet($cell['attributes'], 'locked-icon') ? $cell['attributes']['locked-icon'] : $this->_checkedOutIcon;
         $text = $this->istSet($cell['attributes'], 'locked-text') ? $cell['attributes']['locked-text'] : $this->_checkedOutIcon;
         $this->_out[] = '<a href="#" rel="sp-tooltip" data-original-title="' . $text . '" class="checkedout">';
         $this->_out[] = '<i class="icon-' . $icon . '"></i>';
         $this->_out[] = '</a>';
         return $cell;
     }
     $type = $this->istSet($cell['attributes'], 'input-type') ? $cell['attributes']['input-type'] : 'checkbox';
     if (isset($cell['attributes']['rel']) && $cell['attributes']['rel']) {
         $this->_out[] = '<input type="' . $type . '" name="spToggle" value="1" rel="' . $cell['attributes']['rel'] . '"/>';
         return $cell;
     } else {
         $multiple = $this->istSet($cell['attributes'], 'multiple', 'false') ? null : '[]';
         $this->_out[] = '<input type="' . $type . '" name="' . $cell['attributes']['name'] . $multiple . '" value="' . $cell['content'] . '"/>';
         return $cell;
     }
 }