Ignore:
Timestamp:
05/12/11 11:52:50 (13 years ago)
Author:
afernandes
Message:

Ticket #1416 - Disponibilizado módulo de recursos para a comunidade

File:
1 edited

Legend:

Unmodified
Added
Removed
  • contrib/Dms/inc/inc.ClassDocument.php

    r3526 r4362  
    33function getDocument($id) 
    44{ 
     5         
     6//      echo "aggggi".$id; 
    57        if (!is_numeric($id)) 
    68                die ("invalid documentid"); 
    79         
    810        $queryStr = "SELECT * FROM phpgw_mydms_Documents WHERE id = " . $id; 
     11         
     12        //echo "<br>documentos".$queryStr."<br>"; 
    913        $resArr = $GLOBALS['mydms']->db->getResultArray($queryStr); 
    1014        if (is_bool($resArr) && $resArr == false) 
     
    1519 
    1620        $resArr = $resArr[0]; 
    17         $newDocument = new Document($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["locked"], $resArr["keywords"], $resArr["sequence"]); 
    18  
     21        $newDocument = new Document($resArr["id"], $resArr["name"], $resArr["comment"], $resArr["date"], $resArr["expires"], $resArr["owner"], $resArr["folder"], $resArr[7], $resArr[8], $resArr[9], $resArr["keywords"], $resArr["sequence"]); 
     22 
     23         
    1924        if($newDocument->getAccessMode(getUser($GLOBALS['phpgw_info']['user']['account_id'])) > M_NONE) 
    2025                return $newDocument; 
     
    419424                                return M_NONE; 
    420425                } 
    421                  
     426                return $this->getAccessList2(); 
    422427                //Berechtigung erben?? 
    423428                // wird ï¿œber GetAccessList() bereits realisiert. 
     
    431436                } 
    432437                */ 
    433                 $highestPrivileged = M_NONE; 
     438        /*      $highestPrivileged = M_NONE; 
    434439                 
    435440                //ACLs durchforsten 
     
    465470                 
    466471                //Standard-Berechtigung verwenden 
    467                 return $this->getDefaultAccess(); 
    468         } 
    469  
     472                return $this->getDefaultAccess();*/ 
     473        } 
     474function getAccessList2() 
     475        { 
     476                 
     477                $grupos=read_repository2($GLOBALS['phpgw_info']['user']['account_id']); 
     478        //      echo "".$GLOBALS['phpgw_info']['user']['account_id']; 
     479 
     480        if($grupos!=''){ 
     481                        $queryStr = "SELECT * FROM phpgw_mydms_acls WHERE targettype = ".T_FOLDER." AND target in ( select folder from phpgw_mydms_Documents WHERE id=" . $this->_id . ") and (userid=".$GLOBALS['phpgw_info']['user']['account_id']." or groupid in (".$grupos."))  ORDER BY targettype"; 
     482        }else{ 
     483                                        $queryStr = "SELECT * FROM phpgw_mydms_acls WHERE targettype = ".T_FOLDER." AND target in  ( select folder from phpgw_mydms_Documents WHERE id=" . $this->_id . ") and (userid=".$GLOBALS['phpgw_info']['user']['account_id']." )  ORDER BY targettype"; 
     484                 
     485        } 
     486//echo "aqui".$queryStr ; 
     487                        $resArr = $GLOBALS['mydms']->db->getResultArray($queryStr); 
     488 
     489 
     490                        if (is_bool($resArr) && !$resArr) 
     491                                return false; 
     492                         
     493                        //$this->_accessList = array("groups" => array(), "users" => array()); 
     494                        foreach ($resArr as $row) 
     495                        { 
     496                                 
     497                                                                //echo "el grupo de acceso es".$row[4]."   ".$row["groupid"]."<br>"; 
     498                                return $row["mode"]; 
     499                                /*if ($row["userid"] != -1) 
     500                                        array_push($this->_accessList["users"], new UserAccess($row["userid"], $row["mode"])); 
     501                                else //if ($row["groupID"] != -1) 
     502                                        array_push($this->_accessList["groups"], new GroupAccess($row["groupid"], $row["mode"]));*/ 
     503                        } 
     504                 
     505 
     506                return $this->_accessList; 
     507        } 
    470508        function getNotifyList() 
    471509        { 
     
    683721                ); 
    684722                         
    685                 if(!$this->db->select('phpgw_mydms_DocumentContent', $cols, $where, __LINE__, __FILE__)) { 
     723                if(!$this->db->select('phpgw_mydms_DocumentContent', $cols, $where, __LINE__, __FILE__, false, 'ORDER BY version,id desc')) { 
    686724                        return false; 
    687725                } 
Note: See TracChangeset for help on using the changeset viewer.