Index: trunk/extensions/PageSchemas/PageSchemas.classes.php |
— | — | @@ -21,7 +21,32 @@ |
22 | 22 | } |
23 | 23 | $output->addModules( 'jquery' ); |
24 | 24 | } |
25 | | - |
| 25 | + public static function getCategoriesWithPSDefined(){ |
| 26 | + $cat_titles = array(); |
| 27 | + $dbr = wfGetDB( DB_SLAVE ); |
| 28 | + //get the result set, query : slect page_props |
| 29 | + $res = $dbr->select( 'page_props', |
| 30 | + array( |
| 31 | + 'pp_page', |
| 32 | + 'pp_propname', |
| 33 | + 'pp_value' |
| 34 | + ), |
| 35 | + array( |
| 36 | + 'pp_propname' => 'PageSchema' |
| 37 | + ) |
| 38 | + ); |
| 39 | + while ( $row = $dbr->fetchRow( $res ) ) { |
| 40 | + if( $row[2] != null ){ |
| 41 | + $page_id_cat = $row[0]; |
| 42 | + if( Title::newFromId($page_id_cat)->getNamespace() == NS_CATEGORY){ |
| 43 | + $cat_text = Title::newFromId($page_id_cat)->getText(); |
| 44 | + $cat_titles[] = $cat_text; |
| 45 | + } |
| 46 | + } |
| 47 | + } |
| 48 | + $dbr->freeResult( $res ); |
| 49 | + return $cat_titles; |
| 50 | + } |
26 | 51 | |
27 | 52 | /** |
28 | 53 | * Includes the necessary Javascript and CSS files for the form |