/** * @param int $sid * @param bool $redirect * @return void */ protected function checkIn($sid, $redirect = true) { if ($sid) { $this->setModel(SPLoader::loadModel($this->_type)); $this->_model->load($sid); $this->_model->checkIn(); } if ($redirect) { Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url())); } }
/** * Creates the approved/unapproved symbol * * @param SPDataModel $row * @return string */ public static function approval($row) { /* check state */ $state = $row->get('approved') ? 1 : 0; SPLoader::loadClass('html.tooltip'); /* get icons */ $up = Sobi::Cfg('list_icons.unapproved'); $pu = Sobi::Cfg('list_icons.approved'); $img = $state == 1 ? $pu : $up; $action = $state ? $row->get('oType') . '.unapprove' : $row->get('oType') . '.approve'; /* translate alternative text */ $s = Sobi::Txt($row->get('oType') . '.approval_head'); $a = Sobi::Txt('approval_' . ($state ? 'on' : 'off')); $img = SPTooltip::toolTip($a, $s, $img); /* if user has permission for this action */ if (SPFactory::user()->can($action)) { $url = SPFactory::mainframe()->url(array('task' => $action, 'sid' => $row->get('id'))); $img = "<a href=\"{$url}\">{$img}</a>"; } return $img; }