public function generate() { $this->setId(uniqid()); if ($this->useStore) { } else { $onclick = MAction::getOnClick($this->action, $this->getId()); $this->addEvent('click', $onclick); } $this->setContent(MUtil::detectUTF8($this->label) ? $this->label : utf8_encode($this->label)); return parent::generate(); }
public function checkLogin() { Manager::logMessage('[LOGIN] Running CheckLogin'); // if not checking logins, we are done if (!MUtil::getBooleanValue(Manager::$conf['login']['check'])) { Manager::logMessage('[LOGIN] I am not checking login today...'); return true; } // we have a session login? $session = Manager::getSession(); $login = $session->getValue('__sessionLogin'); $loginMiolo = $_SESSION['login']; // Miolo compatibility if ($loginMiolo) { if (is_null($login)) { // se ainda não tem login no Maestro... $user = Manager::getModelMAD('user'); $user->getByLogin($loginMiolo->id); $profile = $user->getProfileAtual(); $user->getByProfile($profile); $login = new MLogin($user); $this->setLogin($login); Manager::logMessage("[LOGIN] Authenticated {$loginMiolo->idkey} from Miolo"); } } if ($login) { if ($login->getLogin()) { Manager::logMessage('[LOGIN] Using session login: '******'[LOGIN] Using existing login:'******'[LOGIN] No Login but Login required!'); return false; }
public function insertClass($cssClass) { $this->cssClass = $cssClass . MUtil::ifNull($this->cssClass, '', ' ' . $this->cssClass); }
public function setName($name) { MUtil::setIfNull($this->property->id, $name); parent::setName($name); }
function convertValue($value, $className) { // if we are a string, just use the normal conversion // methods from the java extension... try { if ($className == 'java.lang.String') { $temp = new Java('java.lang.String', MUtil::NVL($value, '')); return $temp; } else { if ($className == 'java.lang.Boolean' || $className == 'java.lang.Integer' || $className == 'java.lang.Long' || $className == 'java.lang.Short' || $className == 'java.lang.Double' || $className == 'java.math.BigDecimal') { $temp = new Java($className, $value); return $temp; } else { if ($className == 'java.sql.Timestamp' || $className == 'java.sql.Time') { $temp = new Java($className); $javaObject = $temp->valueOf($value); return $javaObject; } else { if ($className == 'java.io.InputStream') { $stream = new Java('java.io.ByteArrayInputStream', $value); $temp = new Java('javax.imageio.ImageIO'); $image = $temp->read($stream); return $image; } } } } } catch (Exception $err) { echo 'unable to convert value, ' . $value . ' could not be converted to ' . $className; return false; } echo 'unable to convert value, class name ' . $className . ' not recognised'; return false; }
public static function arrayMergeOverwrite($arr1, $arr2) { foreach ($arr2 as $key => $value) { if (array_key_exists($key, $arr1) && is_array($value)) { $arr1[$key] = MUtil::arrayMergeOverwrite($arr1[$key], $arr2[$key]); } else { $arr1[$key] = $value; } } return $arr1; }
public function setShowValues($value) { $this->showValues = MUtil::getBooleanValue($value); $this->list->setShowValues($this->showValues); }
public function setItemsFromResult($result, $basename, $key = '0', $data = '1') { // for while, only for bi-dimensional results // column 0 - key used to group data // column 1 - data $otree = MUtil::arrayTree($result, $key, $data); $this->items['root'][] = array(0, $basename, ''); $i = 0; foreach ($otree as $key => $tree) { $this->items[0][] = array(++$i, $key, ''); $j = $i; foreach ($tree as $t) { $this->items[$j][] = array(++$i, $t[0], ''); } } $this->jsItems = "identifier: 'id', label: 'description', items: [" . $this->getJsItems($this->items['root']) . "]"; }
public function uploadFile() { //mdump($_FILES); $files = \MUtil::parseFiles('uploadFile'); if (is_array($files)) { foreach ($files as $file) { $path = \Manager::getPublicPath('exemplos', '', 'files/' . $file->getName()); $file->copyTo($path); } } $files = \MUtil::parseFiles('uploadMultiple'); if (is_array($files)) { foreach ($files as $file) { $path = \Manager::getPublicPath('exemplos', '', 'files/' . $file->getName()); $file->copyTo($path); } } $go = 'exemplos/controls/formFileUpload'; $this->renderPrompt('information', 'OK', $go); }
public static function SPI() { return MUtil::getBooleanValue(self::$instance->getOptions('SPI')); }
public function saveAssociationById(PersistentObject $object, $associationName, $id) { $object->retrieveAssociation($associationName); $associationIds = MUtil::parseArray($object->{'get' . $associationName}()->getId()); //$ids = array_unique(array_merge($associationIds, MUtil::parseArray($id))); $classMap = $object->getClassMap(); $commands = array(); //$this->_saveAssociationById($object, $associationName, $commands, $classMap, $ids); $this->_saveAssociationById($object, $associationName, $commands, $classMap, $id); $this->execute($classMap->getDb(), $commands); }