public static function removeAllMedlemRader(Medlem $medlem) { $rader = self::lister(get_class(), "medlem_id", $medlem->getId()); foreach ($rader as $rad) { $rad->delete(); } }
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; } }
public function setMedlem(Medlem $medlem) { $this->medlem = $medlem; $this->medlem_id = $medlem->getId(); }
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; } }
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"); }
public function setMedlem(Medlem $medlem) { $this->medlem = $medlem; $this->setMedlemId($medlem->getId()); }
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; } }
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; }
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; }
} $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);
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"); }
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); }