00001 <?php
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 require_once FASTFRAME_ROOT . 'lib/FastFrame/DataAccess.php';
00026
00027
00028
00029
00040
00041 class FF_DataAccess_Resolution_mysql extends FF_DataAccess {
00042
00043
00050 function FF_DataAccess_Resolution_mysql()
00051 {
00052 FF_DataAccess::FF_DataAccess();
00053 $this->table = $this->o_registry->getConfigParam('data/resolutions_table');
00054 }
00055
00056
00057
00058
00067 function update($in_data)
00068 {
00069 $o_result =& parent::update($in_data);
00070 if ($o_result->isSuccess()) {
00071 $this->_setIsDefaultToFalse($in_data);
00072 }
00073
00074 return $o_result;
00075 }
00076
00077
00078
00079
00088 function add($in_data)
00089 {
00090 $o_result =& parent::add($in_data);
00091 if ($o_result->isSuccess()) {
00092 $this->_setIsDefaultToFalse($in_data);
00093 }
00094
00095 return $o_result;
00096 }
00097
00098
00099
00100
00107 function getResolutionOptions()
00108 {
00109 $s_query = "SELECT id, name FROM $this->table ORDER BY name";
00110 return $this->o_data->getAssoc($s_query);
00111 }
00112
00113
00114
00115
00122 function getResolutionResponses()
00123 {
00124 $s_query = "SELECT id, default_response FROM $this->table";
00125 return $this->o_data->getAssoc($s_query);
00126 }
00127
00128
00129
00130
00138 function getDefaultValue()
00139 {
00140 $s_query = "SELECT id FROM $this->table WHERE is_default=1 OR 1 ORDER BY is_default DESC LIMIT 1";
00141 return $this->o_data->getOne($s_query);
00142 }
00143
00144
00145
00146
00153 function getNextId()
00154 {
00155
00156 $this->o_data->setOption('seqname_format', '%s');
00157 return $this->o_data->nextId($this->o_registry->getConfigParam('data/sequence_table'));
00158 }
00159
00160
00161
00162
00172 function _setIsDefaultToFalse($in_data)
00173 {
00174 if ($in_data['is_default']) {
00175 $this->o_data->autoExecute($this->table, array('is_default' => 0), DB_AUTOQUERY_UPDATE, 'id \!= ' . $this->o_data->quoteSmart($in_data['id']));
00176 }
00177 }
00178
00179
00180 }
00181 ?>