Beispiel #1
0
 public function delete()
 {
     Security::demand(EDITOR);
     if ($this->isRattSvar()) {
         $this->getQuizFraga()->removeRattSvar();
         $this->getQuizFraga()->commit();
     }
     parent::delete();
 }
Beispiel #2
0
 public static function getDefault()
 {
     if (!self::$theDefault) {
         // we use loadById to load the object with an "isDefault" value of 1
         try {
             self::$theDefault = parent::loadById(1, get_class(), "isDefault");
             return self::$theDefault;
         } catch (Exception $e) {
             // no default found, return false instead
             return false;
         }
     } else {
         return self::$theDefault;
     }
 }
Beispiel #3
0
 public function delete()
 {
     Security::demand(SUPERADMIN);
     global $ADMIN;
     if ($this->getId() == $ADMIN->getId()) {
         throw new AdminException("Du kan inte ta bort dig själv", -2);
     }
     if ($this->getMedlem()) {
         $this->getMedlem()->setAdmin(false);
     }
     parent::delete();
 }
Beispiel #4
0
 public static function getMedlemOlastaMailCount($medlem)
 {
     return count(parent::multiLister(get_class(), array("to_id" => $medlem->getId(), "is_read" => 0)));
 }
Beispiel #5
0
 public function delete()
 {
     global $db;
     $sql = "DELETE FROM mm_anslagstavlarad WHERE anslagstavla_id = " . $this->getId();
     $db->query($sql);
     parent::delete();
 }
Beispiel #6
0
 public function delete()
 {
     Security::demand(SUPERADMIN);
     parent::delete();
 }
Beispiel #7
0
 public static function deleteUserStrackor(Medlem $medlem, $cleared = true)
 {
     if (Security::authorized(ADMIN) or Security::authorized(USER, $medlem)) {
         if ($cleared) {
             $strackor = parent::lister(get_class(), "medlem_id", $medlem->getId());
         } else {
             $strackor;
         }
         foreach ($strackor as $stracka) {
             $stracka->delete();
         }
     }
 }
 public static function getMedlemFolders($medlem)
 {
     return parent::lister(get_class(), "medlem_id", $medlem->getId(), "folder_name");
 }
Beispiel #9
0
 public function delete()
 {
     Security::demand(FORETAG, $this->getForetag());
     global $db;
     $sql = "UPDATE " . Foretag::KEY_TABLE . " SET lag_id = null WHERE lag_id = " . $this->getId();
     $db->query($sql);
     parent::delete();
 }
Beispiel #10
0
 /**
  * Function listAll	
  * Lister For users
  * Example:
  *      listAll  (   )
  */
 public static function listAll()
 {
     return parent::lister(get_class());
 }
Beispiel #11
0
 public static function listByKommun(Kommun $kommun)
 {
     return parent::lister(get_class(), "kommun_id", $kommun->getId());
 }
Beispiel #12
0
 public function delete()
 {
     Security::demand(USER, $this->getMedlem());
     new FeedItem("stegrapport", $this->getAntal() * $this->getAktivitet()->getVarde() * -1, $this->getMedlem());
     /*if($this->getLast())
     		throw new StegException("Kan inte ta bort låst stegrapport", -6);
     		else*/
     parent::delete();
 }
Beispiel #13
0
 private function deleteGroup()
 {
     $this->removeMailInvites();
     Anslagstavla::deleteAllGruppPosts($this);
     FeedItem::deleteAllGruppFeedItems($this);
     //medlemskap i kluben (mm_medlemIGrupp)
     global $db;
     $sql = "DELETE FROM " . self::RELATION_TABLE . " WHERE grupp_id = " . $this->getId();
     $db->query($sql);
     parent::delete();
 }
Beispiel #14
0
 public static function listField($field, $order = "namn")
 {
     return parent::listField($field, get_class(), $order);
 }
Beispiel #15
0
 public function delete()
 {
     global $db;
     // Kolla om det är ägaren eller kanske en admin som försöker ta bort quizet
     if (Security::authorized(ADMIN) || Security::authorized(USER, $this->getMedlem())) {
         // Hämta och loopa igenom alla quizets frågor
         $fragor = $this->getQuestions();
         foreach ($fragor as $fraga) {
             // Ta bort frågan
             $this->deleteQuestion($fraga['id']);
             // Ta bort alla svar som hör till frågan
             $db->query('DELETE FROM ' . parent::TABLEPREFIX . self::QUIZ_ANSWERS_TABLE . ' WHERE minaquiz_fragor_id = ' . $fraga['id']);
         }
         // Ta bort själva quizet
         parent::delete();
     } else {
         throw new SecurityException("Ej behörig", "Du har inte behörighet att ta bort quizet");
     }
 }
Beispiel #16
0
 public static function listByKommunId($id)
 {
     return parent::lister(get_class(), "kommun_id", $id);
 }
Beispiel #17
0
 public static function listByIds($ids)
 {
     return parent::listByIds(get_class(), $ids, false, "datum DESC");
 }
Beispiel #18
0
 public function delete()
 {
     global $USER;
     //Security::demand(USER, $this->getMedlem());
     if (Security::authorized(ADMIN) || Security::authorized(USER, $this->getMedlem())) {
         // Leta reda på alla bilder som tillhör detta fotoalbum
         $medlem = Medlem::loadById($this->getMedlemId());
         $bilder = FotoalbumBild::listAsArray($medlem, $this->getId());
         for ($x = 0; $x < count($bilder); $x++) {
             // .. och plocka bort bild för bild
             $bild = FotoalbumBild::loadById($bilder[$x]["id"]);
             $bild->delete();
         }
         // Plocka bort själva fotoalbumet
         parent::delete();
     } else {
         throw new SecurityException("Ej behörig", "Du har inte behörighet att ta bort bilden");
     }
 }
Beispiel #19
0
 /**
  * Function getQueryById
  *
  * Fetches a single query from the database
  *
  * Example:
  *     array getQueryById  ( int $queryId  )
  */
 public static function loadById($queryId)
 {
     return parent::loadById($queryId, get_class());
 }
Beispiel #20
0
 /**
  * List all "foretag". If $showValid is true then an extra "where" parameter isValid = 1 is added.
  * It is only possible to send one or none parameter to "Mobject->lister" some trix are made here (Dr. Krillo)
  * 
  * See Mobject->lister for more details about parameters
  * 
  * Changed by krillo 20090426
  */
 public static function listForetag($offset, $limit, $field, $search, $way, $showValid = null)
 {
     $newField = "id";
     //if (DEBUG) {
     //	echo "Foretag.php->listForetag()<br>";
     //	echo "showValid = " .$showValid . "<br>";
     //	echo "field = " .$field . "<br>";
     //	echo "search = " .$search . "<br>";
     //}
     //if no params at all, add "isValid = 1" when missing or not false
     if ($field == null && $search == null && ($showValid == "true" || $showValid == null)) {
         $newField = "isValid";
         $search = 1;
         //if(DEBUG){
         // 	echo "first <br>";
         //}
     } else {
         if ($field != null && $search != null && ($showValid == "true" || $showValid == null)) {
             //trick in the extra param
             $newField = "isValid=1 and " . $field;
             //if(DEBUG){
             //	echo "second <br>";
             //}
         } else {
             $newField = $field;
             //if(DEBUG){
             //	echo "third - all fields <br>";
             //}
         }
     }
     return parent::lister(get_class(), $newField, $search, "id", $offset, $limit, $search, $way);
 }
Beispiel #21
0
 public static function listField($field)
 {
     return parent::listField($field, get_class());
 }
Beispiel #22
0
 public static function listByIds($ids)
 {
     return parent::listByIds(get_class(), $ids);
 }
Beispiel #23
0
 public function delete()
 {
     Security::demand(KOMMUN, $this->getKommun());
     $this->getBild()->delete();
     if ($this->getFramsidebild()) {
         $this->getFramsidebild()->delete();
     }
     parent::delete();
     $this->getKommun()->justeraFramsidebilder();
 }
Beispiel #24
0
 public static function listMedlemmarNotIn($ids)
 {
     return parent::listByIds(get_class(), $ids, true);
 }
Beispiel #25
0
 public function delete()
 {
     Security::demand(ADMIN);
     if (file_exists($this->getImgPath())) {
         unlink($this->getImgPath());
     }
     parent::delete();
 }
Beispiel #26
0
 public function delete()
 {
     parent::delete();
 }