Exemple #1
0
 function getTemplateData($id)
 {
     global $_LABELS;
     global $_CONF;
     $fields = sprintf("\t\r\n  \t\t\t\tu.*,\r\n\t\t\t\tCONCAT(uc.first,' ',uc.last) AS creator, \r\n\t\t\t\tDATE_FORMAT(u.creator_date,'%s') AS f_creator_date, \r\n\t\t\t\tCONCAT(ue.first,' ',ue.last) AS editor, \r\n\t\t\t\tDATE_FORMAT(u.editor_date,'%s') AS f_editor_date, \r\n\t\t\t\tCONCAT(us.first,' ',us.last) AS super, \r\n\t\t\t\tDATE_FORMAT(u.birthdate,'%s') AS f_birthdate, \r\n\t\t\t\tz.zone", $_CONF['date_format_mysql'], $_CONF['date_format_mysql'], $_CONF['date_format_mysql']);
     $tables = "tblUsers AS u, tblUsers AS us, tblUsers AS uc, tblUsers AS ue";
     $left = "tblZones AS z";
     $on = "u.zone_id = z.id";
     $param = sprintf("u.id = '%s' AND u.super_id = us.id AND u.creator_id = uc.id AND u.editor_id = ue.id", $id);
     $data = current(SQL::select_leftjoin($tables, $fields, $left, $on, $param));
     $data['super'] = WEBPAGE::hotlink('BS.SCR.viewUser', 'id', $data['super_id'], $data['super']);
     $data['name'] = sprintf("%s %s %s", $data['first'], $data['middle'], $data['last']);
     $data['status'] = $_LABELS[sprintf('tblUsers.active.%s', $data['active'])];
     $data['zone'] = WEBPAGE::hotlink('BS.SCR.viewZone', 'id', $data['zone_id'], $data['zone']);
     $data['membership'] = self::getMembership($data['access_code']);
     $data['img_path'] = sprintf(WEBPAGE::_IMG_USER, $data['username']);
     if ($_CONF[auto_photo] && !file_exists($data['img_path'])) {
         $img_remote_path = sprintf("http://web.jce.do/consultas/FOTOS/%s/%s/%s/%s.jpg", substr($data['code'], 0, 3), substr($data['code'], 4, 2), substr($data['code'], 6, 2), $data['code']);
         if (!($fp_remote = @fopen($img_remote_path, "r"))) {
             $data['img_path'] = './img/unknown.png';
         } else {
             $data['img_path'] = $img_remote_path;
         }
         /*
           		if ($fp_remote=fopen($img_remote_path, "r")) {
         			$fp_local = fopen($img_path,"w");
         			$image = fread($fp_remote,102400);
         			fwrite($fp_local,$image,102400);
             		fclose($fp_remote);
             		fclose($fp_local);
         			}
         */
     }
     $c = 0;
     $data['buttondata'][$c][id] = "BS.SCR.addUser";
     $data['buttondata'][$c][href] = "index.php?scr_name=BS.SCR.addUser&id=" . $id;
     $data['buttondata'][$c][alt] = $_LABELS['edit'];
     $data['buttondata'][$c][onClick] = "";
     $data['buttondata'][$c][ico] = "edit";
     if ($data['active']) {
         $c++;
         $data['buttondata'][$c][id] = "BS.SCR.suspendUser";
         $data['buttondata'][$c][href] = "index.php?scr_name=BS.SCR.suspendUser&id=" . $id;
         $data['buttondata'][$c][alt] = $_LABELS['deactivate'];
         $data['buttondata'][$c][onClick] = "";
         $data['buttondata'][$c][ico] = "user_rem";
     }
     return $data;
 }
Exemple #2
0
 function getTemplateData($id)
 {
     global $_LABELS;
     global $_CONF;
     $client = new CLIENT($id);
     $data = $client->data;
     $data['society_code'] = sprintf("%s.%s.%s", str_pad($data['zone_id'], 3, '0', STR_PAD_LEFT), $data['category'], str_pad($data['society_id'], 5, '0', STR_PAD_LEFT));
     $data['society_code'] = WEBPAGE::hotlink('BS.SCR.viewSociety', 'id', $data['society_id'], $data['society_code']);
     $zone = CLIENT::zones();
     $data['zone'] = $zone[$data['zone_id']];
     $data['advisor'] = current(SQL::getAssoc('tblUsers', 'id,CONCAT(first," ",last)', sprintf("id = '%s'", $data['advisor_id'])));
     $data['advisor'] = WEBPAGE::hotlink('BS.SCR.viewUser', 'id', $data['advisor_id'], $data['advisor']);
     $cstatus = CLIENT::cstatus();
     $data['cstatus'] = $cstatus[$data['cstatus']];
     $education = CLIENT::education();
     $data['education'] = $education[$data['education']];
     /**
       $data['img_path']		  = sprintf(WEBPAGE::_IMG_CLIENT,$data['code']);
     
       if (($_CONF[auto_photo])&&(!(file_exists($data['img_path'])))) {
         $img_remote_path = sprintf("http://web.jce.do/consultas/FOTOS/%s/%s/%s/%s.jpg",substr($data['code'],0,3),substr($data['code'],4,2),substr($data['code'],6,2),$data['code']);
     
     	if (!($fp_remote=@fopen($img_remote_path, "r"))) {
     	  $data['img_path']	= './img/unknown.png';
     	  } else {
           $data['img_path'] = $img_remote_path;
       	  }
         }
     */
     $c = 0;
     if ($data['advisor_id']) {
         $data['buttondata'][$c]['id'] = "BS.SCR.addClient";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=BS.SCR.addClient&id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['edit'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "edit";
         $c++;
         $data['buttondata'][$c]['id'] = "LN.SCR.browseLoans";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=LN.SCR.browseLoans&loan_code=." . str_pad($id, 6, 0, STR_PAD_LEFT);
         $data['buttondata'][$c]['alt'] = $_LABELS['LN.SCR.browseLoans'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "money_history";
         $c++;
         $data['buttondata'][$c]['id'] = "BS.SCR.moveClient";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=BS.SCR.moveClient&ref=BS.SCR.editClient&id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['moveClient'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "client_move";
         $c++;
         $data['buttondata'][$c]['id'] = "BS.SCR.deactivateClient";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=BS.SCR.deactivateClient&ref=BS.SCR.editClient&id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['deactivate'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "client_rem";
         $c++;
         $data['buttondata'][$c]['id'] = "BS.SCR.addBusiness";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=BS.SCR.addBusiness&owner_id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['addBusiness'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "business_add";
         $c++;
         $data['buttondata'][$c]['id'] = "SV.SCR.applySurveyStepB";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=SV.SCR.browseSurveys&ref=SV.SCR.applySurveyStepA&client_id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['applySurvey'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "survey_apply";
         $c++;
         $data['buttondata'][$c]['id'] = "SV.SCR.viewGraph";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=SV.SCR.browseSurveys&stats_client_id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['SV.SCR.viewGraph'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "survey_results";
         $c++;
     } else {
         $data['buttondata'][$c]['id'] = "BS.SCR.addClient";
         $data['buttondata'][$c]['href'] = "index.php?scr_name=BS.SCR.addClient&ref=BS.SCR.editClient&activate=1&id=" . $id;
         $data['buttondata'][$c]['alt'] = $_LABELS['activate'];
         $data['buttondata'][$c]['onClick'] = "";
         $data['buttondata'][$c]['ico'] = "client_add";
         $c++;
     }
     $data['buttondata'][$c]['id'] = "BS.SCR.viewClientIOM";
     $data['buttondata'][$c]['href'] = 'javascript:openWin("index.popup.php?scr_name=BS.SCR.viewClientIOM&ref=BS.SCR.viewClient&id=' . $id . '","ClientIOM","menubar=no,scrollbars=no,resizable=no,width=700,height=320")';
     $data['buttondata'][$c]['alt'] = $_LABELS['movements'];
     $data['buttondata'][$c]['onClick'] = "";
     $data['buttondata'][$c]['ico'] = "client_history";
     $c++;
     return $data;
 }