コード例 #1
0
 $pluginManager->unsetTemporary('files');
 $notifyInput = new JUI\Input('nachricht');
 $notifyInput->setLabel('Nachricht: ');
 $notifyInput->setValue($data);
 $jUI->add($notifyInput);
 $submitButton = new JUI\Button('Nachricht senden', TRUE);
 $jUI->add($submitButton);
 //$nachrichten = $pluginManager->databaseManager->getValues(Array("recipient"=>Array("value"=>$recipient, "operator"=>"=", "or"=>array("name"=>"sender","value"=>$recipient))));
 $nachrichten = $pluginManager->databaseManager->getValues(array('((`recipient`=? AND `sender`=?) OR (`recipient`=? AND `sender`=?))', 'iiii', array($recipient, $loginManager->getId(), $loginManager->getId(), $recipient)));
 if (!empty($nachrichten)) {
     foreach ($nachrichten as $nachricht) {
         $sender = $nachricht['sender'];
         $type = $nachricht['type'];
         $senderView = new JUI\Text($senderList[$sender]['username']);
         $senderView->setAppearance(JUI\Text::BOLDITALIC);
         $senderView->setColor('#' . stringToColorCode($sender));
         if (!empty($type) && $type == '1') {
             $file = $nachricht['text'];
             if ($pluginManager->fileManager->fileExists('thumb/' . $file, TRUE, FileManager::FILESYSTEM_PLUGIN_PUBLIC)) {
                 $file = 'thumb/' . $file;
             }
             $hash = $pluginManager->fileManager->getImageHash($file, FileManager::FILESYSTEM_PLUGIN_PUBLIC);
             $contentView = new JUI\Image($hash);
             $contentView->setClick(new JUI\Click(JUI\Click::openMedia, 'image', FileManager::FILESYSTEM_PLUGIN_PUBLIC . '://plg_messenger/' . $nachricht['text']));
         } else {
             $contentView = new JUI\Text($nachricht['text']);
             if ($nachricht['sender'] != $loginManager->getId()) {
                 $senderView->setAlign(JUI\Text::RIGHT);
                 $contentView->setAlign(JUI\Text::RIGHT);
             }
         }
コード例 #2
0
<?php

require_once $pluginManager->getController('tools');
if (!empty($_POST['color'])) {
    $color = stringToColorCode($_POST['color']);
    $text = new JUI\Text("#" . $color);
    $text->setColor("#" . $color);
    $jUI->add($text);
}
$jUI->add(new JUI\Input("color"));
$button = new JUI\Button("Senden", TRUE);
$jUI->add($button);
コード例 #3
0
ファイル: design_helper.php プロジェクト: kostya1017/our
/**
 * function marketplace_graph_color
 *
 */
function marketplace_graph_color($marketplace)
{
    $CI =& get_instance();
    $colors = $CI->config->item('market_colors');
    return isset($colors[$marketplace]) ? $colors[$marketplace] : stringToColorCode($marketplace);
}
コード例 #4
0
ファイル: chart_m.php プロジェクト: kostya1017/our
 /**
  * Pre process the data to use in google charts
  *
  * @param array $data
  * @param array $report_where
  * @param String $chartType
  * @return array
  */
 public function prepGoogleData($data, $report_where, $chartType)
 {
     if (empty($data)) {
         $data = array();
     }
     $store_id = get_instance()->store_id;
     //define chart type, colors come from global config
     //use productId as indexes for data=>result keys
     $googleData = array('type' => '', 'date' => array('start' => time(), 'end' => time()), 'data' => array('size' => 0));
     $marketColors = $this->config->item('market_colors');
     $prepData = array();
     switch ($chartType) {
         case 'scatter':
             /* example price array - only take what we need for the google data
             		array('price' => '17.59', 'retail' => '30.85', 'wholesale' => '17.56', 'map' => '21.6', 'count' => '1', 'upc' => '658010113403', 'title' => 'GARDEN OF LIFE 100% Organic Extra Virgin Coconut Oil 32 fl.oz', 'marketplace' => 'Shopping.com', 'url' => 'http://www.allstarhealth.com/de_p_ref/21115/DT21115/GARDEN_OF_LIFE_100Percent_Organic_Extra_Virgin_Coconut_Oil.htm', 'dt' => '1340074876', 'prod_id' => '391', 'timestamp' => '1340074876', 'hash_key' => 'AllStarHealth#658010113403', 'merchant' => 'AllStarHealth', 'original_name' => 'AllStarHealth', 'merchant_id' => '9183', 'date' => '06/18/2012 20:01:16')*/
             //scatterchart
             $c = 0;
             $googleData['type'] = 'scatter';
             //we can't have the start & end be the same for the scatter chart
             $googleData['date']['start'] = $report_where['date_from'];
             $googleData['date']['end'] = $report_where['date_to'] == $report_where['date_from'] ? $report_where['date_from'] + 86400 : $report_where['date_to'];
             $googleData['date']['earliest'] = time();
             $googleData['data']['size'] = sizeof($data);
             $num_outliers = 0;
             foreach ($data as $prodId => $prodData) {
                 // create the prepData and calculate average on pass 1
                 $avg = 0;
                 for ($i = 0, $n = sizeof($prodData); $i < $n; $i++) {
                     $price = (double) $prodData[$i]['price'];
                     $map = (double) $prodData[$i]['map'];
                     $violation = $price < $map;
                     $avg += $price;
                     $prepData[$prodId][] = array('price' => $price, 'map' => $map, 'marketplace' => $prodData[$i]['marketplace'], 'merchant' => getMerchantName($prodData[$i]['merchant_id']), 'merchant_id' => $prodData[$i]['merchant_id'], 'timestamp' => $prodData[$i]['timestamp'], 'violation' => $violation);
                     //reset earliest date if necessary
                     if ($prodData[$i]['timestamp'] < $googleData['date']['earliest']) {
                         $googleData['date']['earliest'] = $prodData[$i]['timestamp'];
                     }
                 }
                 // Calculate standard deviation on pass 2
                 $avg = $n > 0 ? round($avg / $n, 2) : 0;
                 $sd = 0;
                 for ($i = 0; $i < $n; $i++) {
                     $sd += pow($prepData[$prodId][$i]['price'] - $avg, 2);
                 }
                 $sd = $n > 0 ? round(sqrt($sd / $n), 2) : round(sqrt($sd), 2);
                 // find outliers on pass 3
                 $thresh = 3 * $sd;
                 $outliers = array();
                 for ($i = 0; $i < $n; $i++) {
                     if (abs($prepData[$prodId][$i]['price'] - $avg) > $thresh) {
                         $outliers[] = $i;
                         $num_outliers++;
                     }
                 }
                 // build data column
                 $productInfo = getProductUPCByID($prodId, $this->ci->store_id);
                 $mapPrice = getPricingHistory($productInfo['upc_code'], $this->ci->store_id, 'price_floor', $googleData['date']['start'], $googleData['date']['end']);
                 $retailPrice = getPricingHistory($productInfo['upc_code'], $this->ci->store_id, 'retail_price', $googleData['date']['start'], $googleData['date']['end']);
                 $wholeSalePrice = getPricingHistory($productInfo['upc_code'], $this->ci->store_id, 'wholesale_price', $googleData['date']['start'], $googleData['date']['end']);
                 $Color = Color_handler::get_next();
                 $color_info = array('hex' => $Color->get_hex(), 'string' => $Color->get_string());
                 $this->ci->data->colors[] = $color_info;
                 $googleData['data']['columns'][$prodId] = array('type' => 'number', 'color' => $color_info, 'name' => getProductsTitle($prodId), 'pricing' => array('map' => $mapPrice, 'retail' => $retailPrice, 'wholesale' => $wholeSalePrice), 'stats' => array('avg' => $avg, 'sd' => $sd, 'thresh' => $thresh, 'outliers' => $outliers));
                 $c++;
             }
             $googleData['data']['outliers'] = $num_outliers;
             $googleData['data']['result'] = $prepData;
             break;
         case 'line':
         default:
             /* example price array - only take what we need for the google data
             			array(391 => array(0 => array("marketplace" => "amazon", "upc" => "658010113403", "price" => "30.20", "wholesale" => array(0 => array("start" => "0000-00-00 00:00:00", "stamp" => 1340631116, "price" => 17.56)), "retail" => array(0 => array("start" => "0000-00-00 00:00:00", "stamp" => 1340631116, "price" => 30.85)), "map" => array(0 => array("start" => "0000-00-00 00:00:00", "stamp" => 1340631116, "price" => 21.6)), "dt" => 1340089200, "prod_id" => "391"))) */
             $googleData['type'] = 'line';
             $googleData['date']['start'] = $report_where['date_from'];
             $googleData['date']['end'] = $report_where['date_to'];
             $size = $c = 0;
             foreach ($data as $prodId => $data) {
                 $marketColorArray = array();
                 $upc = getProductsUPC($prodId);
                 $marketColorArray[$c] = array();
                 $Color = Color_handler::get_next();
                 $color_info = array('hex' => $Color->get_hex(), 'string' => $Color->get_string());
                 $this->ci->data->colors[] = $color_info;
                 $googleData['data']['columns'][$prodId] = array('type' => 'number', 'color' => $color_info, 'name' => getProductsTitle($prodId), 'pricing' => array('map' => getPricingHistory($upc, $store_id, 'price_floor', $report_where['date_from'], $report_where['date_to']), 'retail' => getPricingHistory($upc, $store_id, 'retail_price', $report_where['date_from'], $report_where['date_to']), 'wholesale' => getPricingHistory($upc, $store_id, 'wholesale_price', $report_where['date_from'], $report_where['date_to'])));
                 foreach ($data as $market => $pricing) {
                     $size++;
                     $marketColorArray['market'][$market] = isset($marketColors[$market]) ? $marketColors[$market] : stringToColorCode($market);
                     foreach ($pricing as $priceArr) {
                         $prepData[$prodId][$market][] = array('upc' => $priceArr['upc'], 'price' => (double) $priceArr['price'], 'dt' => $priceArr['dt'], 'date' => date('Y-m-d', $priceArr['dt']));
                     }
                 }
                 array_push($googleData['data']['columns'][$prodId]['color'], $marketColorArray['market']);
                 $c++;
             }
             $googleData['data']['size'] = $size;
             $googleData['data']['result'] = $prepData;
             break;
     }
     if ($googleData['data']['size'] == 0) {
         $googleData['type'] = "empty";
     }
     //echo "googs<br>\n";
     //var_dump($googleData);exit;
     return $googleData;
 }
コード例 #5
0
ファイル: wsClient.php プロジェクト: anu-priya/securemax-mdm
         $mapKey1 = "latLng";
         $mapKey2 = "name";
         array_push($location, array($mapKey1 => explode(',', $value->location), $mapKey2 => @$value->firstname . ' ' . @$value->lastname));
     }
     echo $jsonValue = json_encode($location);
     break;
 case "allAppointments":
     $allAppointments = WSModel::get_ws_service(BASE_WS_URL . $ws_url['allAppointments'], array(), FALSE);
     $allAppointmentsarr = $allAppointments->response;
     $events = $result = array();
     $rm = 0;
     foreach ($allAppointmentsarr as $key => $value) {
         if (!isset($value->doctorName)) {
             continue;
         }
         $random = stringToColorCode($value->doctorName);
         $bgColor = ColorDarken($random);
         $mapKey1 = "start";
         $mapKey2 = "title";
         $mapKey3 = "tip";
         $mapKey4 = "CareGiver Name";
         $backgroundColor = "backgroundColor";
         $borderColor = "borderColor";
         if (isset($_POST['src'])) {
             array_push($events, array($mapKey1 => date('m/d/Y', strtotime($value->appointmentDate)), $mapKey2 => $value->patientName, $mapKey3 => $value->doctorName, $mapKey4 => $value->careGiverName, $backgroundColor => $bgColor, $borderColor => "#f56954"));
         } else {
             array_push($events, array($mapKey1 => $value->appointmentDate, $mapKey2 => $value->patientName, $mapKey3 => $value->doctorName, $mapKey4 => $value->careGiverName, $backgroundColor => $bgColor, $borderColor => "#f56954"));
         }
         $rm++;
     }
     echo $jsonValue = json_encode($events);