-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
119 changed files
with
8,286 additions
and
612 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
<?php | ||
|
||
namespace backend\models; | ||
|
||
/** | ||
* HassCMS (http:https://www.hassium.org/) | ||
* | ||
* @link http:https://github.com/hasscms for the canonical source repository | ||
* @copyright Copyright (c) 2016-2099 Hassium Software LLC. | ||
* @license http:https://opensource.org/licenses/gpl-license.php GNU Public License | ||
*/ | ||
namespace backend\models; | ||
use common\models\Attachment; | ||
|
||
/** | ||
* | ||
* @package hass\package_name | ||
* @author zhepama <[email protected]> | ||
* @since 0.1.0 | ||
* | ||
*/ | ||
class MediaItem | ||
{ | ||
const TYPE_FILE = 'file'; | ||
|
@@ -72,8 +86,7 @@ public function __construct($path, $size, $lastModified, $type, $publicUrl) | |
*/ | ||
public static function createFromAttachment($attachment) | ||
{ | ||
$file = $attachment->getFile(); | ||
$item = new static($attachment->getAbsolutePath(),$file->getSize(),$file->getTimestamp(),$file->getType(),$attachment->url); | ||
$item = new static($attachment->path,$attachment->size, $attachment->updated_at, 'file', $attachment->url); | ||
return $item; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace common\behaviors; | ||
|
||
use yii\base\Behavior; | ||
|
||
class BaseAttachAttribute extends Behavior | ||
{ | ||
|
||
/** | ||
* | ||
* @var \yii\db\ActiveRecord | ||
*/ | ||
public $owner; | ||
|
||
|
||
/** | ||
* @var string | ||
*/ | ||
public $attribute; | ||
|
||
/** | ||
* | ||
* @var mixed | ||
*/ | ||
protected $value; | ||
|
||
|
||
public function canGetProperty($name, $checkVars = true) | ||
{ | ||
return parent::canGetProperty($name, $checkVars) || $this->attribute == $name; | ||
} | ||
|
||
// 根据特性返回这个值 | ||
public function __get($name) | ||
{ | ||
if ($name != $this->attribute) { | ||
return parent::__get($name); | ||
} | ||
if ($this->value == null) { | ||
$this->value = $this->getValue(); | ||
} | ||
return $this->value; | ||
} | ||
|
||
protected function getValue() | ||
{ | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.