Exemplo n.º 1
0
 /**
  * Change status by bid
  * bid is the uniqueID of articles
  *
  * @param   string	$what field to change
  * @param   integer $id ID of the item to change
  * @param   integer $value value to set (0 = off, 1 = on)
  * @return  void
  */
 public function set_by_bid($what, $id, $value = 0)
 {
     // check permissions
     $val = $what == 'xlock' ? 4 : 3;
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'articles', $id, $val);
     if (is_null($msg)) {
         $qs = X4Route_core::get_query_string();
         // do action
         $mod = new Article_model();
         $result = $mod->update_by_bid($id, array($what => $value));
         // set message
         $this->dict->get_words();
         $msg = AdmUtils_helper::set_msg($result);
         // set update
         if ($result[1]) {
             $msg->update[] = array('element' => $qs['div'], 'url' => urldecode($qs['url']), 'title' => null);
         }
     }
     $this->response($msg);
 }