4 require_once
"Services/Object/classes/class.ilObject2.php";
36 $this->online = (bool)$a_value;
56 $this->comments = (bool)$a_value;
86 $this->ppic = (bool)$a_status;
96 $this->
default = (bool)$a_value;
119 $this->bg_color =
"ffffff";
131 $this->bg_color = (string)$a_value;
141 if(!$this->font_color)
143 $this->font_color =
"505050";
155 $this->font_color = (string)$a_value;
175 $this->img = (string)$a_value;
182 $set = $ilDB->query(
"SELECT * FROM usr_portfolio".
183 " WHERE id = ".$ilDB->quote($this->id,
"integer"));
184 $row = $ilDB->fetchAssoc($set);
198 $ilDB->manipulate(
"INSERT INTO usr_portfolio (id,is_online,is_default)".
199 " VALUES (".$ilDB->quote($this->id,
"integer").
",".
200 $ilDB->quote($this->
isOnline(),
"integer").
",".
201 $ilDB->quote($this->
isDefault(),
"integer").
")");
214 $ilDB->manipulate(
"UPDATE usr_portfolio SET".
215 " is_online = ".$ilDB->quote($this->isOnline(),
"integer").
216 ",comments = ".$ilDB->quote($this->hasPublicComments(),
"integer").
217 ",ppic = ".$ilDB->quote($this->hasProfilePicture(),
"integer").
218 ",is_default = ".$ilDB->quote($this->isDefault(),
"integer").
219 ",bg_color = ".$ilDB->quote($this->getBackgroundColor(),
"text").
220 ",font_color = ".$ilDB->quote($this->getFontcolor(),
"text").
221 ",img = ".$ilDB->quote($this->getImage(),
"text").
222 " WHERE id = ".$ilDB->quote($this->id,
"integer"));
230 include_once
"Services/Portfolio/classes/class.ilPortfolioPage.php";
232 foreach($pages as $page)
240 $ilDB->manipulate(
"DELETE FROM usr_portfolio".
241 " WHERE id = ".$ilDB->quote($this->id,
"integer"));
255 foreach(self::getPortfoliosOfUser($a_user_id) as $item)
257 $all[] = $item[
"id"];
261 $ilDB->manipulate(
"UPDATE usr_portfolio".
262 " SET is_default = ".$ilDB->quote(
false,
"integer").
263 " WHERE ".$ilDB->in(
"id", $all,
"",
"integer"));
268 $ilDB->manipulate(
"UPDATE usr_portfolio".
269 " SET is_default = ".$ilDB->quote(
true,
"integer").
270 " WHERE id = ".$ilDB->quote($a_portfolio_id,
"integer"));
284 $set = $ilDB->query(
"SELECT up.*,od.title,od.description".
285 " FROM usr_portfolio up".
286 " JOIN object_data od ON (up.id = od.obj_id)".
287 " WHERE od.owner = ".$ilDB->quote($a_user_id,
"integer").
288 " ORDER BY od.title");
290 while ($rec = $ilDB->fetchAssoc($set))
307 if(!$ilSetting->get(
'user_portfolios'))
312 $set = $ilDB->query(
"SELECT up.id FROM usr_portfolio up".
313 " JOIN object_data od ON (up.id = od.obj_id)".
314 " WHERE od.owner = ".$ilDB->quote($a_user_id,
"integer").
315 " AND up.is_default = ".$ilDB->quote(1,
"integer"));
316 $res = $ilDB->fetchAssoc($set);
335 return $path.$this->img;
351 include_once
"Services/Portfolio/classes/class.ilFSStoragePortfolio.php";
368 include_once
"Services/Portfolio/classes/class.ilFSStoragePortfolio.php";
372 $path = $storage->getAbsolutePath().
"/";
376 $path .= $a_subdir.
"/";
403 $clean_name = preg_replace(
"/[^a-zA-Z0-9\_\.\-]/",
"", $a_upload[
"name"]);
406 $original =
"org_".$this->id.
"_".$clean_name;
407 $thumb =
"thb_".$this->id.
"_".$clean_name;
408 $processed = $this->
id.
"_".$clean_name;
410 if(@move_uploaded_file($a_upload[
"tmp_name"],
$path.$original))
412 chmod(
$path.$original, 0770);
415 $dimensions = $prfa_set->get(
"banner_width").
"x".
416 $prfa_set->get(
"banner_height");
423 ilUtil::execConvert($original_file.
"[0] -geometry 100x100 -quality 100 JPEG:".$thumb_file);
424 ilUtil::execConvert($original_file.
"[0] -geometry ".$dimensions.
"! -quality 100 JPEG:".$processed_file);
442 include_once
"Services/Portfolio/classes/class.ilPortfolioAccessHandler.php";
445 foreach($all as $item)
447 $access_handler->removePermission($item[
"id"]);
449 $portfolio =
new self($item[
"id"],
false);
450 $portfolio->delete();