32        $this->db = 
$DIC->database();
 
   47        $set = 
$ilDB->query(
"SELECT * FROM badge_image_templ_type");
 
   48        while ($row = 
$ilDB->fetchAssoc($set)) {
 
   49            $types[$row[
"tmpl_id"]][] = $row[
"type_id"];
 
   52        $set = 
$ilDB->query(
"SELECT * FROM badge_image_template" .
 
   54        while ($row = 
$ilDB->fetchAssoc($set)) {
 
   55            $row[
"types"] = (array) 
$types[$row[
"id"]];
 
   58            $obj->importDBRow($row);
 
   69        foreach (self::getInstances() as $tmpl) {
 
   70            if (!
sizeof($tmpl->getTypes()) ||
 
   71                in_array($a_type_unique_id, $tmpl->getTypes())) {
 
   86        $this->
id = (int) $a_id;
 
   96        $this->title = trim($a_value);
 
  106        $this->image = trim($a_value);
 
  116        $this->types = is_array(
$types)
 
  132        if ($this->
getId() &&
 
  133            $a_upload_meta[
"tmp_name"]) {
 
  139            $suffix = strtolower(array_pop(explode(
".", 
$filename)));
 
  140            $tgt = $path . 
"img" . $this->
getId() . 
"." . $suffix;
 
  151        if ($this->
getId()) {
 
  155                $suffix = strtolower(array_pop(explode(
".", $this->
getImage())));
 
  174        $path = $storage->getAbsolutePath() . 
"/";
 
  177            $path .= $a_subdir . 
"/";
 
  179            if (!is_dir($path)) {
 
  196        $set = 
$ilDB->query(
"SELECT * FROM badge_image_template" .
 
  197            " WHERE id = " . 
$ilDB->quote($a_id, 
"integer"));
 
  198        if (
$ilDB->numRows($set)) {
 
  199            $row = 
$ilDB->fetchAssoc($set);
 
  211        $set = 
$ilDB->query(
"SELECT * FROM badge_image_templ_type" .
 
  212            " WHERE tmpl_id = " . 
$ilDB->quote($a_id, 
"integer"));
 
  213        while ($row = 
$ilDB->fetchAssoc($set)) {
 
  214            $res[] = $row[
"type_id"];
 
  226        $this->
setId($a_row[
"id"]);
 
  236        if ($this->
getId()) {
 
  240        $id = 
$ilDB->nextId(
"badge_image_template");
 
  244        $fields[
"id"] = array(
"integer", 
$id);
 
  246        $ilDB->insert(
"badge_image_template", $fields);
 
  255        if (!$this->
getId()) {
 
  262            "badge_image_template",
 
  264            array(
"id" => array(
"integer", $this->
getId()))
 
  270    public function delete()
 
  274        if (!$this->
getId()) {
 
  281        $ilDB->manipulate(
"DELETE FROM badge_image_template" .
 
  282            " WHERE id = " . 
$ilDB->quote($this->getId(), 
"integer"));
 
  288            "title" => array(
"text", $this->
getTitle()),
 
  289            "image" => array(
"text", $this->
getImage())
 
  297        if ($this->
getId()) {
 
  298            $ilDB->manipulate(
"DELETE FROM badge_image_templ_type" .
 
  299                " WHERE tmpl_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
 
  304                        "tmpl_id" => array(
"integer", $this->
getId()),
 
  305                        "type_id" => array(
"text", 
$type)
 
  307                    $ilDB->insert(
"badge_image_templ_type", $fields);
 
An exception for terminatinating execution or to throw for unit testing.
setTypes(array $types=null)
uploadImage(array $a_upload_meta)
importDBRow(array $a_row)
__construct($a_id=null)
Constructor.
getFilePath($a_id, $a_subdir=null)
Init file system storage.
getPropertiesForStorage()
static getInstancesByType($a_type_unique_id)
static getValidFilename($a_filename)
Get valid filename.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
foreach($_POST as $key=> $value) $res