Example #1
0
    // default content
    $db->Execute('TRUNCATE TABLE ' . CGEXTENSIONS_TABLE_COUNTRIES);
    $sqlarray = $dict->CreateIndexSQL('cge_idx_countries1', CGEXTENSIONS_TABLE_COUNTRIES, 'code', array('UNIQUE' => 1));
    $dict->ExecuteSQLArray($sqlarray);
    $fn = cms_join_path(dirname(__FILE__), 'countries.txt');
    $raw_countries = @file($fn);
    $query = 'INSERT INTO ' . CGEXTENSIONS_TABLE_COUNTRIES . ' (code,name,sorting) VALUES (?,?,0)';
    foreach ($raw_countries as $one) {
        list($acronym, $country_name) = explode(',', $one);
        $acronym = trim($acronym);
        $country_name = trim($country_name);
        $db->Execute($query, array($acronym, $country_name));
    }
    $db->Execute('TRUNCATE TABLE ' . CGEXTENSIONS_TABLE_STATES);
    $sqlarray = $dict->CreateIndexSQL('cge_idx_states1', CGEXTENSIONS_TABLE_STATES, 'code', array('UNIQUE' => 1));
    $dict->ExecuteSQLArray($sqlarray);
    $fn = cms_join_path(dirname(__FILE__), 'states.txt');
    $raw_states = @file($fn);
    $query = 'INSERT INTO ' . CGEXTENSIONS_TABLE_STATES . ' (code,name,sorting) VALUES (?,?,0)';
    foreach ($raw_states as $one) {
        list($acronym, $state_name) = explode(',', $one);
        $acronym = trim($acronym);
        $state_name = trim($state_name);
        $db->Execute($query, array($acronym, $state_name));
    }
}
$loader = new \CGExtensions\jsloader\libdefn('cg_cmsms');
$loader->callback = array('cge_jshandler', 'load');
\CGExtensions\jsloader\jsloader::register($loader);
// this may fail, but let it fail.
$this->AddEventHandler('Core', 'ContentPostRender');
 public static function cgjs_render($params, $smarty)
 {
     $out = \CGExtensions\jsloader\jsloader::render($params);
     if (isset($params['assign'])) {
         $smarty->assign($params['assign'], $out);
         return;
     }
     return $out;
 }
 /**
  * Retrieve some HTML to be output in all admin requests for this module (and its descendants).
  * By default this module calls the jsloader::render method,  and includes some standard styles
  *
  * @abstract
  * @see \CGExtensions\jsloader\jsloader::render();
  * @return bool
  */
 public function GetHeaderHTML()
 {
     $config = \Cmsapp::get_instance()->GetConfig();
     $out = \CGExtensions\jsloader\jsloader::render(array('session' => session_id()));
     $mod = cms_utils::get_module(MOD_CGEXTENSIONS);
     $fn = $mod->find_module_file('css/admin_styles.css');
     if ($fn) {
         $css = str_replace($config['root_path'], $config['root_url'], $fn);
         $out .= '<link rel="stylesheet" href="' . $css . '"/>' . "\n";
     }
     if ($this->GetName() != MOD_CGEXTENSIONS) {
         $fn = $this->find_module_file('css/admin_styles.css');
         if ($fn) {
             $css = str_replace($config['root_path'], $config['root_url'], $fn);
             $out .= '<link rel="stylesheet" href="' . $css . '"/>' . "\n";
         }
     }
     return $out;
 }
# in any Non GPL version of CMS Made simple, or in any version of CMS
# Made simple that does not indicate clearly and obviously in its admin
# section that the site was built with CMS Made simple.
#
# 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 General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#
#-------------------------------------------------------------------------
#END_LICENSE
$db = cge_utils::get_db();
$taboptarray = array('mysql' => 'TYPE=MyISAM');
$dict = NewDataDictionary($db);
$this->DeleteTemplate();
$this->RemovePreference();
$tmp = $dict->DropTableSQL(CGEXTENSIONS_TABLE_COUNTRIES);
$dict->ExecuteSQLArray($tmp);
$tmp = $dict->DropTableSQL(CGEXTENSIONS_TABLE_STATES);
$dict->ExecuteSQLArray($tmp);
$tmp = $dict->DropTableSQL(CGEXTENSIONS_TABLE_ASSOCDATA);
$dict->ExecuteSQLArray($tmp);
\CGExtensions\jsloader\jsloader::unregister_by_module($this->GetName());
$this->RemoveEventHandler('Core', 'ContentPostRender');
#
# EOF
#