source: pro-violet-viettel/sourcecode/api.violet.vn/www/lib/model/Tblspaceresource.php @ 289

Last change on this file since 289 was 289, checked in by dungnv, 11 years ago
File size: 1020 bytes
Line 
1<?php
2
3/**
4 * Subclass for representing a row from the 'tblspaceresource' table.
5 *
6 *
7 *
8 * @package lib.model
9 */
10class Tblspaceresource extends BaseTblspaceresource
11{
12        /**
13         * Initializes internal state of Tblspaceresource object.
14         * @see        parent::__construct()
15         */
16        public function __construct()
17        {
18                // Make sure that parent constructor is always invoked, since that
19                // is where any default values for this object are set.
20                parent::__construct();
21        }
22
23  private function getResPath($create = false) {
24    $resId = $this->getResId();
25    $path = violetUtil::getSpacePath(true) . floor($resId/1000).'/'.$resId;
26    if ($create && !file_exists($path)) mkdir($path, 0777, true);
27    return $path;
28  }
29
30  public function getFullFilename($create = false) {
31    return $this->getResPath($create).'/'.$this->getResFilename();
32  }
33
34  public function delete(PropelPDO $con = null) {
35    $path = $this->getResPath();
36    unlink($path.'/'.$this->getResFilename());
37    rmdir($path);
38    parent::delete($con);
39  }
40}
Note: See TracBrowser for help on using the repository browser.