/** * 获取对象最上层的类型 * * @param int $objid * @return int */ public function getObjectTopType($objid) { $objDao = new View_objectsDao(); $parentid = $objDao->getOne('parentid', "id={$objid}"); if (false === $parentid) { return false; } if ($parentid == 0) { return false; } $cacheName = 'object_path_array'; $infoArr = Tools::getCache($cacheName); if (false === $infoArr) { $infoDao = new View_collectionsDao(); $infoVoList = $infoDao->findAll('', '', 'id,name,object_type,parentid'); if ($infoVoList->isEmpty()) { return false; } $arr = $infoVoList->toArray(); foreach ($arr as $keymaster => $value) { foreach ($value as $key => $element) { $infoArr[$key][$keymaster] = $element; } } self::setCache($cacheName, $infoArr); } $ownerArray = array_reverse(Tools::getCatOwner($infoArr, $parentid, null)); if (count($ownerArray) < 1) { return false; } $key = array_search($ownerArray[0], $infoArr["id"]); if (false === $key) { return false; } return $infoArr["object_type"][$key]; }
/** * 获取用户签出的文件 * * @return Array */ public function getCheckouted() { $userid = Session::get(USER_AUTH_KEY); if (!$userid) { return false; } $objDao = new View_objectsDao(); $vol = $objDao->findAll("status_owner={$userid} and status=1", '', 'id,name,status,status_date,parentid', 'status_date DESC'); $arr = array(); if (!$vol) { return false; } else { $arr = $vol->toResultSet(); } return $arr; }