| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- Doo::loadModel('itematt');
- class ItemFile
- {
- private $__itemfile;
- function __construct()
- {
- $this->__itemfile = new ItemAtt();
- }
- public function insertItemFileRecord($postArray)
- {
- $this->__itemfile->ownerid = $postArray['ownerid'];
- $this->__itemfile->pid = $postArray['pid'];
- $this->__itemfile->pmid = $postArray['pmid'];
- $this->__itemfile->filename = $postArray['filename'];
- $this->__itemfile->fileext = $postArray['fileext'];
- $this->__itemfile->filesize = $postArray['filesize'];
- $this->__itemfile->filepath = $postArray['filepath'];
- $this->__itemfile->intime = time();
- if (isset($postArray['oldiaid']))
- $this->__itemfile->oldiaid = $postArray['oldiaid'];
- return $this->__itemfile->insert();
- }
- public function getItemFile($iaid)
- {
- return $iaid ? $this->__itemfile->getOne(array('where' => 'iaid=?', 'param' => array($iaid), 'asArray' => TRUE)) : FALSE;
- }
- public function getFilesAll($pmid)
- {
- return $pmid ? $this->__itemfile->find(array('where' => 'pmid=?', 'param' => array($pmid), 'asArray' => TRUE)) : FALSE;
- }
- public function getFileHistory($oldiaid)
- {
- return $oldiaid ? $this->__itemfile->find(array('where' => 'oldiaid=?', 'param' => array($oldiaid), 'asArray' => TRUE)) : FALSE;
- }
- public function updateItemFields($id, $fname)
- {
- $this->__itemfile->filename = iconv('GBK', 'UTF-8', $fname);
- return $this->__itemfile->update(array('where' => 'iaid=?', 'param' => array($id)));
- }
- }
- ?>
|