From 5e8fe91169b4655b3c51f6aa893c306a7b803c0f Mon Sep 17 00:00:00 2001 From: Mufaddal Nullwala Date: Fri, 17 Feb 2017 15:54:43 +0530 Subject: [PATCH 1/2] partner information changes --- PartnerInformation/PartnerInformation.php | 15 +- .../class.dashletPartnerInformation.php | 99 +++++++++++-- .../views/dashletPartnerInformation.html | 133 ++++++------------ 3 files changed, 147 insertions(+), 100 deletions(-) diff --git a/PartnerInformation/PartnerInformation.php b/PartnerInformation/PartnerInformation.php index faf7aa1..74c9fd5 100644 --- a/PartnerInformation/PartnerInformation.php +++ b/PartnerInformation/PartnerInformation.php @@ -1,10 +1,21 @@ render($_POST['s_val']); + +} + +if(!empty ($_POST['d_val'])){ + +require_once ("PartnerInformation/classes/class.dashletPartnerInformation.php"); +$call = new dashletPartnerInformation(); +$call->renderDetails($_POST['d_val']); + } class PartnerInformationPlugin extends PMPlugin diff --git a/PartnerInformation/PartnerInformation/classes/class.dashletPartnerInformation.php b/PartnerInformation/PartnerInformation/classes/class.dashletPartnerInformation.php index 573f992..b640380 100644 --- a/PartnerInformation/PartnerInformation/classes/class.dashletPartnerInformation.php +++ b/PartnerInformation/PartnerInformation/classes/class.dashletPartnerInformation.php @@ -2,9 +2,6 @@ require_once ("classes/interfaces/dashletInterface.php"); - - - class dashletPartnerInformation implements DashletInterface { const version = '1.0'; @@ -73,7 +70,7 @@ public static function getAdditionalFields($className) public static function getXTemplate($className) { - return ""; + return ""; } public function setup($config) @@ -88,18 +85,20 @@ public function render($val= null , $width = 300) $stmt = $cnn->createStatement(); if(!empty($_POST)) { + $val = $_POST['s_val']; } $arrayUser = array(); - $sql = "SELECT USR.USR_USERNAME, USR.USR_FIRSTNAME, USR.USR_LASTNAME, USR.USR_STATUS - FROM USERS AS USR + /*$sql = "SELECT USR.USR_USERNAME, USR.USR_FIRSTNAME, USR.USR_LASTNAME, USR.USR_STATUS + FROM USERS AS USR WHERE USR.USR_ROLE = '" . $this->role . "' - ORDER BY USR.USR_USERNAME ASC"; + ORDER BY USR.USR_USERNAME ASC"; */ - $sql = "SELECT PARTNER_NAME, TYPE_OF_PARTNER, ADDRESS, DATE_OF_MEETING, SUMMARY_OF_MEETING, CONTACT_NUMBER, CONTACT_PERSON, EMAIL_ID FROM PMT_PARTNERINFO WHERE Partner_name LIKE '$val%' ORDER BY app_number DESC LIMIT 1"; + //$sql = "SELECT PARTNER_NAME, TYPE_OF_PARTNER, ADDRESS, DATE_OF_MEETING, SUMMARY_OF_MEETING, CONTACT_NUMBER, CONTACT_PERSON, EMAIL_ID FROM PMT_PARTNERINFO WHERE Partner_name LIKE '$val%' ORDER BY app_number DESC LIMIT 1"; + $sql = "SELECT DISTINCT(PARTNER_NAME) as PARTNER_NAME FROM PMT_PARTNERINFO WHERE Partner_name LIKE '$val%' ORDER BY app_number DESC"; $rsSQL = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); while ($rsSQL->next()) { @@ -107,14 +106,54 @@ public function render($val= null , $width = 300) //$arrayUser[] = array("userName" => $row["USR_USERNAME"], "fullName" => $row["USR_FIRSTNAME"] . " " . $row["USR_LASTNAME"], "status" => $row["USR_STATUS"]); - $arrayUser[] = array("partnername" => $row["PARTNER_NAME"], "partnertype" => $row["TYPE_OF_PARTNER"] , "address" => $row["ADDRESS"], "meetingdate" => $row["DATE_OF_MEETING"], "summary" => $row["SUMMARY_OF_MEETING"], "cnumber" => $row["CONTACT_NUMBER"], "cperson" => $row["CONTACT_PERSON"], "email" => $row["EMAIL_ID"] ); + // $arrayUser[] = array("partnername" => $row["PARTNER_NAME"], "partnertype" => $row["TYPE_OF_PARTNER"] , "address" => $row["ADDRESS"], "meetingdate" => $row["DATE_OF_MEETING"], "summary" => $row["SUMMARY_OF_MEETING"], "cnumber" => $row["CONTACT_NUMBER"], "cperson" => $row["CONTACT_PERSON"], "email" => $row["EMAIL_ID"] ); + $arrayUser[] = array("partnername" => $row["PARTNER_NAME"]); + } - + /////// $dashletView = new dashletPartnerInformationView($arrayUser, $this->note); $dashletView->templatePrint(); } + + + +public function renderDetails($val= null , $width = 300) + { + + $cnn = Propel::getConnection("workflow"); + $stmt = $cnn->createStatement(); + + +if(!empty($_POST)) { +$val = $_POST['d_val']; +} + + $arrayUser = array(); + + $sql = "SELECT USR.USR_USERNAME, USR.USR_FIRSTNAME, USR.USR_LASTNAME, USR.USR_STATUS + FROM USERS AS USR + WHERE USR.USR_ROLE = '" . $this->role . "' + ORDER BY USR.USR_USERNAME ASC"; + + + $sql = "SELECT PARTNER_NAME, TYPE_OF_PARTNER, ADDRESS, DATE_OF_MEETING, SUMMARY_OF_MEETING, CONTACT_NUMBER, CONTACT_PERSON, EMAIL_ID FROM PMT_PARTNERINFO WHERE Partner_name LIKE '%$val%' ORDER BY app_number DESC LIMIT 1"; + + $rsSQL = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); + while ($rsSQL->next()) { + $row = $rsSQL->getRow(); + + $arrayUser[] = array("partnername" => $row["PARTNER_NAME"], "partnertype" => $row["TYPE_OF_PARTNER"] , "address" => $row["ADDRESS"], "meetingdate" => $row["DATE_OF_MEETING"], "summary" => $row["SUMMARY_OF_MEETING"], "cnumber" => $row["CONTACT_NUMBER"], "cperson" => $row["CONTACT_PERSON"], "email" => $row["EMAIL_ID"] ); + + } + + /////// + $dashletView = new dashletPartnerInformationViewDetails($arrayUser, $this->note); + $dashletView->templatePrintD(); + } + + } @@ -145,7 +184,7 @@ public function templateRender() { $this->smarty->assign("user", $this->user); $this->smarty->assign("note", $this->note); - + $this->smarty->assign("item", $this->user); return ($this->smarty->fetch($this->smarty->templateFile)); } @@ -155,4 +194,42 @@ public function templatePrint() exit(0); } } + +class dashletPartnerInformationViewDetails extends Smarty +{ + private $smarty; + + private $user; + private $note; + + public function __construct($u, $n) + { + $this->user = $u; + $this->note = $n; + + $this->smarty = new Smarty(); + $this->smarty->compile_dir = PATH_SMARTY_C; + $this->smarty->cache_dir = PATH_SMARTY_CACHE; + $this->smarty->config_dir = PATH_THIRDPARTY . "smarty/configs"; + $this->smarty->caching = false; + $this->smarty->templateFileD = PATH_PLUGINS . "PartnerInformation" . PATH_SEP . "views" . PATH_SEP . "dashletPartnerInfo.html"; + } + + public function templateRenderD() + { + $this->smarty->assign("user", $this->user); + $this->smarty->assign("note", $this->note); + + return ($this->smarty->fetch($this->smarty->templateFileD)); + } + + public function templatePrintD() + { + echo $this->templateRenderD(); + exit(0); + } +} + + + ?> diff --git a/PartnerInformation/PartnerInformation/views/dashletPartnerInformation.html b/PartnerInformation/PartnerInformation/views/dashletPartnerInformation.html index 117e596..79afdd1 100644 --- a/PartnerInformation/PartnerInformation/views/dashletPartnerInformation.html +++ b/PartnerInformation/PartnerInformation/views/dashletPartnerInformation.html @@ -20,6 +20,33 @@ w.close(); } + +function details(id){ +var vald = id.getAttribute('value'); +callAjaxz(vald); +} + + +function callAjaxz(vald){ + console.log(vald); + var https = new XMLHttpRequest(); + var url = "../print/print"; + var params = "d_val="+vald; + https.open("POST", url, true); + https.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + https.onreadystatechange = function() { + if(https.readyState == 4 && https.status == 200) { + var container = document.getElementById("maindiv"); + container.innerHTML = ""; + container.innerHTML = https.responseText; + document.getElementById("search").value = vald ; + } + } + https.send(params); + } + + + function operation(id){ var val = document.getElementById("search").value; @@ -100,31 +127,16 @@ .td{ width:130px; } + + a:hover { + cursor:pointer; + } + {/literal} - -
@@ -133,82 +145,29 @@
-{if $item } +{if $item} +
-
-
-

Partner Details

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- -
- -
- -
- -
- -
- -
- - - +
+ + + + + + {foreach from=$user item=item} + + - + + {/foreach} +
Partner Name
{$item.partnername}
- - - {else}
From 3ca07487326905fca7a197abb4f9e60fc43bae60 Mon Sep 17 00:00:00 2001 From: Mufaddal Nullwala Date: Fri, 17 Feb 2017 15:56:34 +0530 Subject: [PATCH 2/2] add html file --- .../views/dashletPartnerInfo.html | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 PartnerInformation/PartnerInformation/views/dashletPartnerInfo.html diff --git a/PartnerInformation/PartnerInformation/views/dashletPartnerInfo.html b/PartnerInformation/PartnerInformation/views/dashletPartnerInfo.html new file mode 100644 index 0000000..3041e0c --- /dev/null +++ b/PartnerInformation/PartnerInformation/views/dashletPartnerInfo.html @@ -0,0 +1,208 @@ + + + + + + + + + {literal} + + + {/literal} + + + + + +
+
+ + + +
+ +
+ +
+
+

Partner Details

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + + + + +
+
+ + + +
+ +