示例#1
0
 public static function removeAllMedlemRader(Medlem $medlem)
 {
     $rader = self::lister(get_class(), "medlem_id", $medlem->getId());
     foreach ($rader as $rad) {
         $rad->delete();
     }
 }
示例#2
0
 public function isKontakt(Medlem $medlem)
 {
     global $db;
     $sql = "SELECT count(*) FROM " . self::RELATION_TABLE . " WHERE medlem_id = " . $this->getMedlem()->getId() . " AND kontakt_id = " . $medlem->getId();
     if ($db->value($sql) != 0) {
         return true;
     } else {
         return false;
     }
 }
示例#3
0
 public function setMedlem(Medlem $medlem)
 {
     $this->medlem = $medlem;
     $this->medlem_id = $medlem->getId();
 }
示例#4
0
文件: Lag.php 项目: krillo/motiomera
 public function isMember(Medlem $medlem)
 {
     global $db;
     $sql = "SELECT count(*) FROM " . Foretag::KEY_TABLE . " WHERE medlem_id = " . $medlem->getId() . " AND lag_id = " . $this->getId();
     if ($db->value($sql) > 0) {
         return true;
     } else {
         return false;
     }
 }
示例#5
0
 public static function listPokaler(Medlem $medlem = null, $pokal = null)
 {
     global $db;
     $sql = "SELECT * FROM " . self::POKAL_TABLE . " WHERE 1 = 1 ";
     if ($medlem) {
         $sql .= "AND medlem_id = " . $medlem->getId() . " ";
     }
     if ($pokal) {
         $sql .= "AND pokal = '{$pokal}'";
     }
     $res = $db->query($sql);
     return self::res2Array($res, "pokal");
 }
示例#6
0
 public function setMedlem(Medlem $medlem)
 {
     $this->medlem = $medlem;
     $this->setMedlemId($medlem->getId());
 }
示例#7
0
 public function inAdressbok(Medlem $medlem)
 {
     global $db;
     $sql = "SELECT count(*) FROM mm_kontakt WHERE medlem_id = " . $this->getId() . " AND kontakt_id = " . $medlem->getId();
     if ($db->value($sql) != 0) {
         return true;
     } else {
         return false;
     }
 }
示例#8
0
 public function isAnstalld(Medlem $medlem)
 {
     global $db;
     $sql = "SELECT count(*) FROM " . self::KEY_TABLE . " WHERE foretag_id = " . $this->getId() . " AND medlem_id = " . $medlem->getId();
     $value = $db->value($sql);
     return $value == 0 ? false : true;
 }
示例#9
0
 public static function listAsArray(Medlem $medlem, $order_by = "namn ASC")
 {
     global $db;
     $medlem_id = $medlem->getId();
     $sql = $db->query("\tSELECT\n\t\t\t\t\t\t\t\t*\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\tmm_fotoalbum\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tmedlem_id = '" . $medlem_id . "'\n\t\t\t\t\t\t\tORDER BY\n\t\t\t\t\t\t\t\t{$order_by}\n\t\t");
     $fotoalbum = array();
     while ($row = mysql_fetch_array($sql, MYSQL_ASSOC)) {
         foreach ($row as $field => $value) {
             $row[$field] = stripslashes($value);
         }
         $fotoalbum[] = $row;
     }
     return $fotoalbum;
 }
示例#10
0
    }
    $kommun = Kommun::loadById($order->kid);
    $kontotyp = '';
    //legacy or not used right now
    $maffcode = '';
    //legacy or not used right now
    $medlem = new Medlem($order->email, $order->anamn, $kommun, $order->sex, $order->fname, $order->lname, $kontotyp, $maffcode);
    $medlem->setEpostBekraftad(1);
    //medlem valid from start
    $medlem->setLevelId(1);
    //pro from start
    $medlem->confirm($order->pass);
    $medlem->setForetagsnyckel_temp($order->nyckel);
    $medlem->setForetagsnyckel($order->nyckel);
    //krillo 2013-08-29 if the users email the same as the buyers - set her as foretagsadmin in db (mm_medlem:fadmin)
    $foretag = Foretag::loadByForetagsnyckel($order->nyckel);
    $payer_email = $foretag->getPayerEmail();
    if ($payer_email == $order->email) {
        $reset = $foretag->resetAllFadmin();
        if ($reset) {
            $fid = $foretag->getId();
            $medlem->setFadmin($fid, false);
        }
    }
    $medlem->commit();
    //clear mm_medlem in cache, force to reload from the updated db
    global $db;
    $db->removeBufferObject('Medlem', $medlem->getId());
    $medlem->loggaIn($order->email, $order->pass, true);
}
header("Location: " . '/pages/minsida.php?mmForetagsnyckel=' . $order->nyckel);
示例#11
0
文件: Mal.php 项目: krillo/motiomera
 public static function listByMedlem(Medlem $medlem)
 {
     global $db;
     $sql = "SELECT mal_id FROM " . self::RELATION_TABLE . " WHERE medlem_id = " . $medlem->getId();
     $ids = $db->valuesAsArray($sql);
     return self::listByIds($ids, false, "id DESC");
 }
示例#12
0
 public function denyInvite(Medlem $medlem)
 {
     global $db;
     $sql = "UPDATE " . self::RELATION_TABLE . " SET ignorerad = 1 WHERE medlem_id = " . $medlem->getId() . " AND grupp_id = " . $this->getId();
     $db->nonquery($sql);
 }