function findBy($searchParams) { $ct =& CopixDBFactory::getConnection(); $query = $this->_selectQuery; if (!$searchParams->isEmpty()) { $query .= ' WHERE '; $query .= $searchParams->explainSQL(array('branch_id' => array('branch_id', 'autoincrement', 'branch', '%s'), 'branch_name' => array('branch_name', 'string', 'branch', '%s'), 'branch_status' => array('branch_status', 'string', 'branch', '%s'), 'branch_email' => array('branch_email', 'string', 'branch', '%s')), $ct); } $dbWidget =& new CopixDBWidget($ct); return $dbWidget->fetchAllUsing($query, 'CompiledDAORecordBranch'); }
function findBy($searchParams) { $ct =& CopixDBFactory::getConnection(); $query = $this->_selectQuery; if (!$searchParams->isEmpty()) { $query .= ' AND '; $query .= $searchParams->explainSQL(array('contract_id' => array('contract_id', 'autoincrement', 'contract', '%s'), 'worker_id' => array('worker_id', 'int', 'contract', '%s'), 'worker_first_name' => array('worker_first_name', 'string', 'worker', '%s'), 'worker_last_name' => array('worker_last_name', 'string', 'worker', '%s'), 'branch_id' => array('branch_id', 'int', 'contract', '%s'), 'branch_name' => array('branch_name', 'string', 'branch', '%s'), 'wage' => array('wage', 'int', 'contract', '%s'), 'begin_date' => array('begin_date', 'timestamp', 'contract', '%s'), 'end_date' => array('end_date', 'timestamp', 'contract', '%s')), $ct); } $dbWidget =& new CopixDBWidget($ct); return $dbWidget->fetchAllUsing($query, 'CompiledDAORecordContract'); }
/** * Deletes the given user from every groups * @param string $login the user login * @return void */ function removeUser($login) { $ct =& CopixDBFactory::getConnection($this->_connectionName); $query = 'delete from copixusergroup where login_cusr=' . $ct->quote($login); $ct->doQuery($query); }
/** * Check if the login and password match * @param string $login the login * @param string $password the password (clear) */ function checkPassword($login, $password) { $ct = CopixDBFactory::getConnection(); $dbw = CopixDbFactory::getDbWidget(); $query = 'select ' . $this->passwordfield . ' from ' . $this->userTable . ' where ' . $this->loginField . '=' . $ct->quote($login); if ($r = $dbw->fetchFirst($request)) { return $r->{$this->passwordField} == $this->cryptPassword($password); } return false; }
/** * Delete one module if it's possible * @params array $arToDeleteModules array of all module which could be deleted * @params array $arInstalledModule array of all installed modules * @params string $module module to delete */ function _deleteOneModule($moduleName, $arToDeleteModules, $arInstalledModule, &$arError) { //check if there is a module which need the module to delete if (in_array($moduleName, $arInstalledModule)) { $delete = true; foreach ($arInstalledModule as $installedModule) { $toCheck = CopixModule::getInformations($installedModule); foreach ((array) $toCheck->dependencies as $dependency) { if ($dependency == $moduleName) { if (in_array($installedModule, $arToDeleteModules)) { /* replace $installedModule->name_imd par $installed_module*/ if (!CopixModule::_deleteOneModule($installedModule, $arToDeleteModules, $arInstalledModule, $arError)) { /* replace $installedModule->name_imd par $installed_module*/ //one module need the deleted module so we can't delete it .... $delete = false; $arError[] = CopixI18N::get('copix:copixmodule.error.unableToDelete') . ' ' . $moduleName . ', ' . CopixI18N::get('copix:copixmodule.error.moduleIsNeededBy') . ' ' . $toCheck->name; } } else { //one module need the deleted module so we can't delete it .... $delete = false; //die('kouik2 : '. implode($arToDeleteModules,' || ') . ' > ' .$installedModule ); $arError[] = CopixI18N::get('copix:copixmodule.error.unableToDelete') . ' ' . $moduleName . ', ' . CopixI18N::get('copix:copixmodule.error.moduleIsNeededBy') . ' ' . $toCheck->name; } } } } if ($delete) { $scriptFile = CopixModule::_getDeleteFile($moduleName); if ($scriptFile) { $ct = CopixDBFactory::getConnection(); $ct->doSQLScript($scriptFile); } CopixModule::_deleteModuleInDatabase($moduleName); CopixModule::_deleteModuleInPHPCache($moduleName); } return $delete; } else { return true; } }
/** * Check if we have a correct DB Connection */ function _checkDBConnection() { static $dbOk = null; if ($dbOk === null) { //We also check if we're installing or not if (defined('COPIX_INSTALL')) { return $dbOk = false; } if ($GLOBALS['COPIX']['COORD']->getPlugin('copixdb') === null) { $dbOk = false; return false; } $ct = CopixDBFactory::getConnection(); $dbOk = $ct->isConnected(); return $dbOk; } return $dbOk; }
function movePath($path, $newPath) { $ct =& CopixDBFactory::getConnection(); $query = 'update CopixGroupCapabilities set name_ccpb = ' . $ct->quote($newPath) . ' where name_ccpb=' . $ct->quote($path); $ct->doQuery($query); }
/** * Deletes a user from the database * @param string $login the login we wants to delete * @return boolean if the operation succeed */ function delete($login) { $ct = CopixDBFactory::getConnection(); $query = 'delete from ' . $this->userTable . ' where ' . $this->loginField . '=' . $ct->quote($login); return $ct->doQuery($query); }
/** * Check if the database is correct */ function checkDatabase() { $ct = CopixDBFactory::getConnection(); return $ct->isConnected(); }
function &getTools($connectionName = null) { require_once COPIX_DB_PATH . 'CopixDbTools.class.php'; return new CopixDbTools(CopixDBFactory::getConnection($connectionName)); }
function movePath($path, $newPath) { $ct =& CopixDBFactory::getConnection($this->_connectionName); $query = 'update copixgroupcapabilities set name_ccpt = ' . $ct->quote($newPath) . ' where name_ccpt=' . $ct->quote($path); $ct->doQuery($query); }
function removeGroup($id) { $query = 'delete from CopixUserGroup where id_cgrp=' . $id; $ct =& CopixDBFactory::getConnection(); $ct->doQuery($query); }
/** * Création d'un objet de manipulation sur la base * @param string connection name * @return CopixDBTools */ function &_createTools($profilName) { $profil =& CopixDBFactory::_getProfil($profilName); require_once COPIX_DB_PATH . '/drivers/' . $profil->driver . '/CopixDbTools.' . $profil->driver . '.class.php'; //require_once(COPIX_DB_PATH.'/drivers/'.$profil->driver.'/CopixDbResultSet.'.$profil->driver.'.class.php'); $class = 'CopixDbTools' . $profil->driver; //Création de l'objet $obj =& new $class(CopixDBFactory::getConnection($profilName)); $obj->profil = $profil; //$obj->connect ($profil); return $obj; }
function deleteAll() { $query = 'delete from copixmodule'; $ct = CopixDBFactory::getConnection($this->_connectionName); $ct->doQuery($query); }