Project

General

Profile

« Previous | Next » 

Revision 1791

Added by Dietmar over 11 years ago

  1. fixed save search settings

View differences:

class.wb.php
37 37
		parent::__construct($mode);
38 38
	}
39 39

  
40
/**
41
 *
42
 *
43
 * @return array of first visible language pages with defined fields
44
 *
45
 */
46
	public function GetLanguagesDetailsInUsed ( ) {
47
        global $database;
48
        $retVal = array();
49
        $sql =
50
            'SELECT DISTINCT `language`'.
51
            ', `page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,`language`'.
52
            ', `visibility`,`viewing_groups`,`viewing_users`,`position` '.
53
            'FROM `'.TABLE_PREFIX.'pages` '.
54
            'WHERE `level`= \'0\' '.
55
              'AND `root_parent`=`page_id` '.
56
              'AND `visibility`!=\'none\' '.
57
              'AND `visibility`!=\'hidden\' '.
58
            'GROUP BY `language` '.
59
            'ORDER BY `position`';
40 60

  
41
	/**
42
	 *
43
	 *
44
	 * @param mixed $lang
45
	 * @param mixed $level
46
	 * @param mixed $parent
47
	 * @return
48
	 */
49
	public function GetLanguagesPages ( $lang, $level, $parent ) {
50
		global $database;
51
        $page = array();
52
        $sql =
53
        'SELECT `language`,`visibility`,`viewing_groups`,`viewing_users`,`language`,`position`, '.
54
        '`page_id`,`level`,`parent`,`root_parent`,`page_code`,`link` '.
55
        'FROM `'.TABLE_PREFIX.'pages` '.
56
        'WHERE `level`=\''.$level.'\' '.
57
          'AND `language`=\''.$lang['language'].'\' '.
58
          'AND `visibility`!=\'none\' '.
59
          'AND `visibility`!=\'hidden\' '.
60
          'AND `parent`=\''.$parent.'\' '.
61
          'AND `root_parent`=`page_id` '.
62
        'ORDER BY `position`';
63
        if($oPage = $database->query($sql))
64
        {
65
            $page = $oPage->fetchRow(MYSQL_ASSOC);
66
        }
67
        return $page;
61
            if($oRes = $database->query($sql))
62
            {
63
                while($page = $oRes->fetchRow(MYSQL_ASSOC))
64
                {
65
                    if(!$this->page_is_visible($page)) {continue;}
66
                    $retVal[$page['language']] = $page;
67
                }
68
            }
69
        return $retVal;
68 70
	}
69 71

  
70
	/**
71
	 *
72
	 *
73
	 * @return
74
	 */
75
	public function GetLanguagesInUsed (  ) {
72
/**
73
 *
74
 *
75
 * @return comma separate list of first visible languages
76
 *
77
 */
78
	public function GetLanguagesInUsed ( ) {
76 79
		global $database;
77 80
        $retVal = '';
78 81
        $page = array();
79 82
        $sql =
80
        'SELECT DISTINCT `language` '.
81
        'FROM `'.TABLE_PREFIX.'pages` '.
82
        'WHERE `level`= \'0\' '.
83
          'AND `visibility`!=\'none\' '.
84
          'AND `visibility`!=\'hidden\' '.
85
       'ORDER BY `position`';
83
            'SELECT DISTINCT `language`'.
84
            ', `page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,`language`'.
85
            ', `visibility`,`viewing_groups`,`viewing_users`,`position` '.
86
            'FROM `'.TABLE_PREFIX.'pages` '.
87
            'WHERE `level`= \'0\' '.
88
              'AND `root_parent`=`page_id` '.
89
              'AND `visibility`!=\'none\' '.
90
              'AND `visibility`!=\'hidden\' '.
91
            'GROUP BY `language` '.
92
            'ORDER BY `position`';
86 93

  
87
        if($oRes = $database->query($sql))
88
        {
89
            while($lang = $oRes->fetchRow(MYSQL_ASSOC))
94
            if($oRes = $database->query($sql))
90 95
            {
91
                $page = $this->GetLanguagesPages ( $lang, 0, 0 );
92
                if(!$this->page_is_visible($page)) {continue;}
93
                $retVal .= $page['language'].',';
96
                while($page = $oRes->fetchRow(MYSQL_ASSOC))
97
                {
98
                    if(!$this->page_is_visible($page)) {continue;}
99
                    $retVal .= $page['language'].',';
100
                }
94 101
            }
95
        }
96
        return trim($retVal,',');
102
            return trim($retVal,',');
97 103
	}
98 104

  
99 105

  
......
135 141
		return $this->is_group_match( $groups_list, $this->get_groups_id() );
136 142
	}
137 143

  
138
	// Check whether a page is visible or not.
139
	// This will check page-visibility and user- and group-rights.
140
	/* page_is_visible() returns
141
		false: if page-visibility is 'none' or 'deleted', or page-vis. is 'registered' or 'private' and user isn't allowed to see the page.
142
		true: if page-visibility is 'public' or 'hidden', or page-vis. is 'registered' or 'private' and user _is_ allowed to see the page.
143
	*/
144
// Check whether a page is visible or not.
145
// This will check page-visibility and user- and group-rights.
146
/* page_is_visible() returns
147
	false: if page-visibility is 'none' or 'deleted', or page-vis. is 'registered' or 'private' and user isn't allowed to see the page.
148
	true: if page-visibility is 'public' or 'hidden', or page-vis. is 'registered' or 'private' and user _is_ allowed to see the page.
149
*/
144 150
	public function page_is_visible($page)
145 151
    {
146 152
		// First check if visibility is 'none', 'deleted'

Also available in: Unified diff