Browse files

new accessors

  • Loading branch information...
1 parent 9fc2795 commit c228e60766942c8eece2942b2ea66edc17892b27 @klaftertief klaftertief committed Feb 1, 2011
Showing with 12 additions and 11 deletions.
  1. +3 −3 extension.driver.php
  2. +9 −8 fields/field.pages.php
View
6 extension.driver.php
@@ -13,13 +13,13 @@ public function about(){
}
public function uninstall(){
- $this->_Parent->Database->query("DROP TABLE `tbl_fields_pages`");
+ Symphony::Database()->query("DROP TABLE `tbl_fields_pages`");
}
public function install(){
- return $this->_Parent->Database->query("CREATE TABLE `tbl_fields_pages` (
+ return Symphony::Database()->query("CREATE TABLE `tbl_fields_pages` (
`id` int(11) unsigned NOT NULL auto_increment,
`field_id` int(11) unsigned NOT NULL,
`allow_multiple_selection` enum('yes','no') NOT NULL default 'no',
@@ -32,7 +32,7 @@ public function install(){
public function update($previousVersion) {
if(version_compare($previousVersion, '1.3', '<')){
- $updated = Administration::instance()->Database->query(
+ $updated = Symphony::Database()->query(
"ALTER TABLE `tbl_fields_pages`
ADD `page_types` varchar(255) default NULL"
);
View
17 fields/field.pages.php
@@ -75,7 +75,7 @@ function getToggleStates($include_parent_titles=true){
$where = NULL;
}
- $pages = $this->_engine->Database->fetch("
+ $pages = Symphony::Database()->fetch("
SELECT
p.*
FROM
@@ -98,7 +98,7 @@ function getToggleStates($include_parent_titles=true){
$bits = array_reverse($bits);
foreach($bits as $h){
- $parent = $this->_engine->Database->fetchVar('title', 0, "SELECT `title` FROM `tbl_pages` WHERE `handle` = '$h' LIMIT 1");
+ $parent = Symphony::Database()->fetchVar('title', 0, "SELECT `title` FROM `tbl_pages` WHERE `handle` = '$h' LIMIT 1");
$title = $parent . ' / ' . $title;
}
}
@@ -111,7 +111,7 @@ function getToggleStates($include_parent_titles=true){
function toggleFieldData($data, $newState){
- $page = $this->_engine->Database->fetchRow(0, "SELECT `title`, `id`, `handle` FROM `tbl_pages` WHERE `id` = '$newState' LIMIT 1");
+ $page = Symphony::Database()->fetchRow(0, "SELECT `title`, `id`, `handle` FROM `tbl_pages` WHERE `id` = '$newState' LIMIT 1");
$data['handle'] = $page['handle'];
$data['title'] = $page['title'];
@@ -183,15 +183,16 @@ function prepareTableValue($data, XMLElement $link=NULL){
function processRawFieldData($data, &$status, $simulate=false, $entry_id=NULL){
$status = self::__OK__;
-
+ var_dump($data);
+ exit;
if(empty($data)) return NULL;
if(!is_array($data)) $data = array($data);
$result = array('title' => array(), 'handle' => array(), 'page_id' => array());
foreach($data as $page_id){
- $page = $this->_engine->Database->fetchRow(0, "SELECT `title`, `handle` FROM `tbl_pages` WHERE `id` = '$page_id' LIMIT 1");
+ $page = Symphony::Database()->fetchRow(0, "SELECT `title`, `handle` FROM `tbl_pages` WHERE `id` = '$page_id' LIMIT 1");
$result['handle'][] = $page['handle'];
$result['title'][] = $page['title'];
@@ -245,9 +246,9 @@ function commit(){
$fields['allow_multiple_selection'] = ($this->get('allow_multiple_selection') ? $this->get('allow_multiple_selection') : 'no');
$fields['page_types'] = $page_types;
- $this->Database->query("DELETE FROM `tbl_fields_".$this->handle()."` WHERE `field_id` = '$id' LIMIT 1");
+ Symphony::Database()->query("DELETE FROM `tbl_fields_".$this->handle()."` WHERE `field_id` = '$id' LIMIT 1");
- if(!$this->Database->insert($fields, 'tbl_fields_' . $this->handle())) return false;
+ if(!Symphony::Database()->insert($fields, 'tbl_fields_' . $this->handle())) return false;
return true;
@@ -318,7 +319,7 @@ function groupRecords($records){
function createTable(){
- return $this->_engine->Database->query(
+ return Symphony::Database()->query(
"CREATE TABLE IF NOT EXISTS `tbl_entries_data_" . $this->get('id') . "` (
`id` int(11) unsigned NOT NULL auto_increment,

0 comments on commit c228e60

Please sign in to comment.