コード例 #1
0
	it under the terms of the GNU Affero General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Affero General Public License for more details.
	
	You should have received a copy of the GNU Affero General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'class.tlondata.php';
require_once 'class.tlonrights.php';
require_once 'class.tlongroup.php';
TlonGroupDocument::$TABLE = new TlonDataTable('tl_group_document', 'groupname, document_id, rights');
class TlonGroupDocument
{
    public static $TABLE = null;
    public static function add($groupname, $document_id, $rights = TlonRights::READ_WRITE, $groupinfo = '')
    {
        if (!TlonGroup::exists($groupname)) {
            if (!TlonGroup::add($groupname, $groupinfo)) {
                return false;
            }
        }
        return TlonData::insert(self::$TABLE, array($groupname, $document_id, $rights));
    }
    public static function deleteByDocumentID($document_id)
    {
        return TlonData::delete(self::$TABLE, TlonDataComparison::equals('document_id', $document_id));
コード例 #2
0
ファイル: Document.php プロジェクト: raisanen/tlon
 private function getByGroup($groupname)
 {
     $out = false;
     if ($dgs = TlonGroupDocument::getByGroupname($groupname)) {
         $out = array();
         foreach ($dgs as $dg) {
             $doc = TlonDocument::getByID($dg['document_id']);
             array_push($out, array('id' => $dg['document_id'], 'title' => $doc['title'], 'rights' => $dg['rights'], 'parent' => $doc['parent']));
         }
     }
     return $out;
 }