コード例 #1
0
 function ajaxBasemed24Action()
 {
     $limit = (int) $this->_getParam('limit');
     if (!$limit > 0) {
         $limit = 25;
     }
     $tradename = file_get_contents('php://input');
     $tradename = urldecode($tradename);
     $tradename = preg_replace('/[^A-Za-z0-9\\-\\%\\ ]+/', '', $tradename);
     //trigger_error('tradename: ' .$tradename ,E_USER_NOTICE);
     //$tradename = 'lipitor';
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $medIterator = new BaseMed24Iterator(null, false);
     $formulary = 'default';
     $config = new ConfigItem();
     $config->configId = 'defaultFormulary';
     $config->populate();
     if (strlen($config->value) > 0) {
         $formulary = substr($config->value, 9);
     }
     $medIterator->setFilters(array('tradename' => $tradename, 'limit' => $limit, 'formulary' => $formulary));
     //trigger_error(print_r($medIterator->toJsonArray(array('tradename','strength','unit','packsize','packtype','ndc')),true),E_USER_NOTICE);
     $matches = $medIterator->toJsonArray('id', array('tradename', 'strength', 'unit', 'packsize', 'packtype', 'ndc', 'inFormulary', 'md5', 'fda_drugname'), true);
     if (count($matches) > 0) {
         $json->direct($matches);
         return;
     }
     $json->direct(false);
 }
コード例 #2
0
ファイル: Service.php プロジェクト: jakedorst/ch3-dev-preview
 public static function getServices()
 {
     $ok = true;
     $services = array();
     $service = array();
     $id = 'nsdr';
     $service['id'] = $id;
     $service['name'] = 'NSDR';
     $nsdrStatus = NSDR::systemStatus();
     if ($nsdrStatus === false) {
         $ok = false;
         $nsdrStatus = 'stopped';
     }
     if ($nsdrStatus != 'started' && $nsdrStatus != 'reloaded') {
         $ok = false;
     }
     $service['status'] = ucwords($nsdrStatus);
     $services[$id] = $service;
     $service = array();
     $id = 'hl7d';
     $service['id'] = $id;
     $service['name'] = 'Processing Daemon';
     $hl7Status = false;
     // temporarily set to false
     if ($hl7Status === false) {
         $hl7Status = 'stopped';
     }
     $service['status'] = ucwords($hl7Status);
     $services[$id] = $service;
     $service = array();
     $id = 'menu';
     $service['id'] = $id;
     $service['name'] = 'Menu';
     $configItem = new ConfigItem();
     $configItem->configId = 'enableCache';
     $configItem->populate();
     $menuStatus = __('Disable');
     if ($configItem->value) {
         $menuStatus = __('Enable');
     } else {
         $ok = false;
     }
     $service['status'] = $menuStatus;
     $services[$id] = $service;
     $memcache = Zend_Registry::get('memcache');
     $serviceNominal = $memcache->get(self::SERVICE_NOMINAL);
     if ($ok) {
         $memcache = Zend_Registry::get('memcache');
         $memcache->set(self::SERVICE_NOMINAL, true);
     } else {
         if ($serviceNominal !== false) {
             $memcache->delete(self::SERVICE_NOMINAL);
         }
     }
     return $services;
 }
コード例 #3
0
 public function menuXmlAction()
 {
     //echo "<!-- start ts " . calcTS() . "-->";
     header("Cache-Control: public");
     header("Pragma: public");
     $cache = Zend_Registry::get('cache');
     $cacheKey = "menu-" . Menu::getCurrentlySelectedActivityGroup() . "-" . Menu::getCurrentUserRole();
     $cacheKey = str_replace('-', '_', $cacheKey);
     $cacheKey = str_replace('/', '_', $cacheKey);
     if ($cache->test($cacheKey . "_hash")) {
         $hash = $cache->load($cacheKey . "_hash");
         $lastModified = $cache->load($cacheKey . "_lastModified");
         $headers = getallheaders();
         if (isset($headers['If-None-Match']) && preg_match('/' . $hash . '/', $headers['If-None-Match'])) {
             header("Last-Modified: " . $lastModified);
             header('HTTP/1.1 304 Not Modified');
             exit;
         }
     }
     $menuXml = "";
     if (false && $cache->test($cacheKey)) {
         $menuXml = $cache->load($cacheKey);
     } else {
         $menuXml = Menu::generateCurrentMenu();
         $hash = md5($menuXml);
         $lastModified = gmdate("D, d M Y H:i:s") . " GMT";
         $objConfig = new ConfigItem();
         $objConfig->configId = 'enableCache';
         $objConfig->populate();
         if ($objConfig->value) {
             $cache->save($hash, $cacheKey . "_hash", array('tagMenu'));
             $cache->save($lastModified, $cacheKey . "_lastModified", array('tagMenu'));
             $cache->save($menuXml, $cacheKey, array('tagMenu'));
         }
         header("ETag: " . $hash);
         header("Last-Modified: " . $lastModified);
         header("Content-length: " . mb_strlen($menuXml));
     }
     $this->view->menuXml = $menuXml;
     header('Content-Type: application/xml;');
     $this->render('menuXml');
     //echo "<!-- second ts " . calcTS() . "-->";
 }
コード例 #4
0
 /**
  * Static method to retrieve the default formulary table name or config id
  *
  * @return mixed FALSE if default formulary table does not exists (boolean), otherwise the default table name (string)
  */
 public static function getDefaultFormularyTable()
 {
     // use a separate ConfigItem object instead of $this->_config for isolation purposes
     $config = new ConfigItem();
     $config->configId = self::DEFAULTFORMULARYID;
     $config->populate();
     $ret = $config->value;
     if (strlen($ret) <= 0) {
         $ret = false;
     }
     return $ret;
 }
コード例 #5
0
ファイル: pyload_types.php プロジェクト: nemiah/trinityDB
 public function read($input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->name);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->description);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 3:
                 if ($ftype == TType::LST) {
                     $this->items = array();
                     $_size0 = 0;
                     $_etype3 = 0;
                     $xfer += $input->readListBegin($_etype3, $_size0);
                     for ($_i4 = 0; $_i4 < $_size0; ++$_i4) {
                         $elem5 = null;
                         $elem5 = new ConfigItem();
                         $xfer += $elem5->read($input);
                         $this->items[] = $elem5;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }
コード例 #6
0
ファイル: Action.php プロジェクト: jakedorst/ch3-dev-preview
 protected function _renderToolbar($phtml = "toolbar")
 {
     header("Cache-Control: public");
     header("Pragma: public");
     $cache = Zend_Registry::get('cache');
     $className = get_class($this);
     $className = str_replace('Controller', '', $className);
     $keyPref = substr(strtolower(preg_replace('/([A-Z]{1})/', '_\\1', $className)), 1);
     $cacheKey = $keyPref . "-toolbar-" . Menu::getCurrentlySelectedActivityGroup() . "-" . Menu::getCurrentUserRole();
     $cacheKey = str_replace('-', '_', $cacheKey);
     $cacheKey = str_replace('/', '_', $cacheKey);
     if ($cache->test($cacheKey . "_hash")) {
         $hash = $cache->load($cacheKey . "_hash");
         $lastModified = $cache->load($cacheKey . "_lastModified");
         $headers = getallheaders();
         if (isset($headers['If-None-Match']) && ereg($hash, $headers['If-None-Match'])) {
             header("Last-Modified: " . $lastModified);
             header('HTTP/1.1 304 Not Modified');
             exit;
         }
     }
     if ($cache->test($cacheKey)) {
         $items = $cache->load($cacheKey);
     } else {
         $items = $this->render($phtml);
         $hash = md5($items);
         $lastModified = gmdate("D, d M Y H:i:s") . " GMT";
         $objConfig = new ConfigItem();
         $objConfig->configId = 'enableCache';
         $objConfig->populate();
         if ($objConfig->value) {
             $cache->save($hash, $cacheKey . "_hash", array('tagToolbar'));
             $cache->save($lastModified, $cacheKey . "_lastModified", array('tagToolbar'));
             $cache->save($items, $cacheKey, array('tagToolbar'));
         }
         header("ETag: " . $hash);
         header("Last-Modified: " . $lastModified);
         header("Content-length: " . mb_strlen($items));
     }
     header("Content-type: text/xml");
     return $items;
 }
コード例 #7
0
 public function toolbarAction()
 {
     header("Cache-Control: public");
     header("Pragma: public");
     $cache = Zend_Registry::get('cache');
     $cacheKey = "toolbar-" . Menu::getCurrentlySelectedActivityGroup() . "-" . Menu::getCurrentUserRole();
     $cacheKey = str_replace('-', '_', $cacheKey);
     $cacheKey = str_replace('/', '_', $cacheKey);
     if ($cache->test($cacheKey . "_hash")) {
         $hash = $cache->load($cacheKey . "_hash");
         $lastModified = $cache->load($cacheKey . "_lastModified");
         $headers = getallheaders();
         if (isset($headers['If-None-Match']) && ereg($hash, $headers['If-None-Match'])) {
             header("Last-Modified: " . $lastModified);
             header('HTTP/1.1 304 Not Modified');
             exit;
         }
     }
     if ($cache->test($cacheKey)) {
         $items = $cache->load($cacheKey);
     } else {
         $items = $this->render('toolbar');
         $hash = md5($items);
         $lastModified = gmdate("D, d M Y H:i:s") . " GMT";
         $objConfig = new ConfigItem();
         $objConfig->configId = 'enableCache';
         $objConfig->populate();
         if ($objConfig->value) {
             $cache->save($hash, $cacheKey . "_hash", array('tagToolbar'));
             $cache->save($lastModified, $cacheKey . "_lastModified", array('tagToolbar'));
             $cache->save($items, $cacheKey, array('tagToolbar'));
         }
         header("ETag: " . $hash);
         header("Last-Modified: " . $lastModified);
         header("Content-length: " . mb_strlen($items));
     }
     if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) {
         header("Content-type: application/xhtml+xml");
     } else {
         header("Content-type: text/xml");
     }
     return $items;
 }
コード例 #8
0
    public function processMenuReloadAction()
    {
        // clear cache
        $cache = Zend_Registry::get('cache');
        $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('tagMenu'));
        // check cache config
        $objConfig = new ConfigItem();
        $objConfig->configId = 'enableCache';
        $objConfig->populate();
        if (!$objConfig->value > 0) {
            $objConfig->value = 1;
            $objConfig->persist();
        }
        $data = true;
        $basePath = Zend_Registry::get('basePath');
        $jsActionFile = $basePath . '/js/menuActions.js';
        if (file_exists($jsActionFile) && !is_writable($jsActionFile) && chmod($basePath . '/js', 0777) === false) {
            $data = __('menuActions.js file is not writable');
        } else {
            $menuActions = '';
            $mainMenu = array();
            $menuItems = MenuItem::getMenuItems();
            foreach ($menuItems as $menu) {
                $idName = preg_replace('/\\ |[^A-Za-z]/', '_', strtolower($menu['title']));
                $mainMenu["{$menu['siteSection']}_{$idName}"] = $menu['jsAction'];
            }
            $menuActions .= <<<EOL
function onMainMenuItemSelected(itemId,itemValue) {
\tswitch (itemId) {
EOL;
            foreach ($mainMenu as $key => $value) {
                $menuActions .= <<<EOL

\t\tcase "{$key}":
\t\t\t{$value}
\t\t\tbreak;
EOL;
            }
            $menuActions .= <<<EOL

\t}
}
EOL;
            copy($jsActionFile, $jsActionFile . '.bak');
            file_put_contents($jsActionFile, $menuActions);
        }
        $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
        $json->suppressExit = true;
        $json->direct($data);
    }
コード例 #9
0
ファイル: Messaging.php プロジェクト: dragonlet/clearhealth
 protected static function _getConfig($configId)
 {
     $configItem = new ConfigItem();
     $configItem->configId = $configId;
     $configItem->populate();
     return $configItem;
 }
コード例 #10
0
ファイル: Config.php プロジェクト: mic2100/skeleton-framework
 /**
  * @param ConfigItem $configItem
  */
 public function addItem(ConfigItem $configItem)
 {
     $this->items[$configItem->getName()] = $configItem;
 }
コード例 #11
0
 /**
  * Clear/Enable/Disable Cache
  */
 public function ajaxChangeCacheSettingsAction()
 {
     $cacheMode = $this->_getParam('cacheMode');
     $msg = '';
     switch (strtolower($cacheMode)) {
         case 'clear':
             $cache = Zend_Registry::get('cache');
             $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('tagMenu'));
             $msg = __("Successfully cleared cache menu");
             break;
         case 'enable':
         case 'disable':
             $objConfig = new ConfigItem();
             $objConfig->configId = 'enableCache';
             $objConfig->populate();
             $objConfig->value = $cacheMode == 'enable' ? 1 : 0;
             $objConfig->persist();
             $msg = __("Successfully {$cacheMode} cache menu");
             break;
         default:
             $msg = __("Invalid action");
     }
     $data = array('msg' => $msg);
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
コード例 #12
0
 function onInstallLanguage($language)
 {
     $configM =& $this->_pluginAPI->getConfigManager();
     $t = $this->_pluginAPI->getI18NManager();
     $cItem = new ConfigItem('/languages/' . $language, STRING);
     $cItem->setValue($language);
     $ret = $configM->addOption($cItem);
     if (isError($ret)) {
         if ($ret->is('CONFIGURATOR_OPTION_EXISTS')) {
             $this->_pluginAPI->addMessage($t->translate('This language already exists'), ERROR);
             $this->_pluginAPI->executePreviousAction();
         } else {
             return $ret;
         }
     } else {
         $this->_pluginAPI->writeConfigFile($configM);
         $this->_pluginAPI->addMessage($t->translate('New language added'), NOTICE);
         $this->_pluginAPI->executePreviousAction();
     }
 }
コード例 #13
0
ファイル: User.php プロジェクト: dragonlet/clearhealth
 public static function communityEditionPlusEnabled()
 {
     $ret = false;
     $configItem = new ConfigItem();
     $configItem->configId = 'communityEditionPlus';
     $configItem->populate();
     if ($configItem->value == 'true') {
         $ret = true;
     }
     return $ret;
 }