コード例 #1
0
ファイル: Path.php プロジェクト: austinvernsonger/casebox
 /**
  * return generic properties for a path of ids
  * @param  varchar | array $p direct path string or an array containig 'path' index defined
  * @return varchar
  */
 public static function getPathProperties($p)
 {
     $path = '';
     if (is_array($p)) {
         if (isset($p['path'])) {
             $path = $p['path'];
         }
     } else {
         $path = $p;
     }
     if (empty($path)) {
         $path = '/';
     }
     while ($path[0] == '/') {
         $path = substr($path, 1);
     }
     $path = explode('/', $path);
     $ids = array_filter($path, 'is_numeric');
     if (empty($ids)) {
         $ids = array(Browser::getRootFolderId());
         $path = $ids;
     }
     $rez = array();
     $lastId = array_pop($ids);
     $r = Objects::getBasicInfoForId($lastId);
     if ($r['success']) {
         $d =& $r['data'];
         $d['path'] = str_replace(',', '/', $d['pids']);
         unset($d['pids']);
         $rez = $d;
     }
     $res->close();
     return $rez;
 }