示例#1
0
 protected function displayError()
 {
     $link = ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity&controller=improvemycity&task=addIssue');
     $html = '<div style="text-align:center;">';
     $html .= '<img src="' . JURI::root(true) . '/components/com_improvemycity/images/error.png' . '" /><br />';
     $html .= '<a href="' . $link . '">' . JText::_('BACK_TO_FORM') . '</a>';
     $html .= '</div>';
     return $html;
 }
示例#2
0
            echo JText::_('ADD_COMMENT');
            ?>
</a>
								</div>
								<div id="commentIndicator" class="imc-right"></div>
								
								<?php 
            //echo JUtility::getToken();
            ?>
							</form>
						<?php 
        } else {
            //not logged
            ?>
							<?php 
            $return = base64_encode(ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity&view=issue&issue_id=' . $this->item->id));
            ?>
								<div class="alert alert-error">
								<?php 
            echo JText::_('ONLY_LOGGED_COMMENT');
            ?>
								<?php 
            echo JText::_('PLEASE_LOG');
            ?>
								<?php 
            /* UNCOMMENT IF YOU WANT login link 
            			<?php $return = base64_encode(ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity&view=issue&issue_id='.$this->item->id)); ?>
            			<a class="modalwin strong-link" rel="{size: {x: 320, y: 350}}" href="index.php?option=com_users&view=login&tmpl=component&return=<?php echo $return; ?>"><span class="strong-link"><?php echo JText::_('PLEASE_LOG');?></span></a>
            			*/
            ?>
								</div>
示例#3
0
 protected function setDocument()
 {
     $document = JFactory::getDocument();
     if ($this->loadbootstrapcss == 1) {
         $document->addStyleSheet(JURI::root(true) . '/components/com_improvemycity/bootstrap/css/bootstrap.min.css');
         $document->addStyleSheet(JURI::root(true) . '/components/com_improvemycity/bootstrap/css/bootstrap-responsive.min.css');
     }
     $document->addStyleSheet(JURI::root(true) . '/components/com_improvemycity/css/mega-menu.css');
     $document->addStyleSheet(JURI::root(true) . '/components/com_improvemycity/css/improvemycity.css');
     //add scripts
     if ($this->loadjquery == 1) {
         $document->addScript(JURI::root(true) . '/components/com_improvemycity/js/jquery-1.7.1.min.js');
     }
     //jquery noConflict
     $document->addScriptDeclaration('var jImc = jQuery.noConflict();');
     if ($this->loadbootstrap == 1) {
         $document->addScript(JURI::root(true) . '/components/com_improvemycity/bootstrap/js/bootstrap.min.js');
     }
     $document->addScript(JURI::root(true) . '/components/com_improvemycity/js/improvemycity.js');
     //add google maps
     //$document->addScript("https://maps.google.com/maps/api/js?sensor=false&language=". $this->language ."&region=". $this->region);
     $document->addScript("https://maps.google.com/maps/api/js?sensor=false&language=" . $this->language . "&region=" . $this->region);
     $document->addScript(JURI::root(true) . '/components/com_improvemycity/js/infobox_packed.js');
     $document->addScriptDeclaration('var jsonMarkers = ' . json_encode($this->getMarkersArrayFromItems()) . ';');
     $LAT = $this->lat;
     $LON = $this->lon;
     //prepare custom icons accordingly (get images from improvemycity categories)
     $this->createCustomMarkers($this->categories);
     $this->customMarkers = substr($this->customMarkers, 0, -2);
     //remove /n and comma
     $googleMap = "\r\n\t\t\tvar geocoder = new google.maps.Geocoder();\r\n\t\t\tvar map;\r\n\t\t\tvar gmarkers = [];\r\n\t\t\t\r\n\t\t\tfunction zoomIn() {\r\n\t\t\t\tmap.setCenter(marker.getPosition());\r\n\t\t\t\tmap.setZoom(map.getZoom()+1);\r\n\t\t\t}\r\n\r\n\t\t\tfunction zoomOut() {\r\n\t\t\t\tmap.setCenter(marker.getPosition());\r\n\t\t\t\tmap.setZoom(map.getZoom()-1);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar customIcons = {\r\n\t\t\t  " . $this->customMarkers . "\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\t// Creating a LatLngBounds object\r\n\t\t\tvar bounds = new google.maps.LatLngBounds();\t\t\t\r\n\t\t\tvar infoWindow = null;\r\n\t\t\tvar infoBox = null;\r\n\t\t\t  \t\t\r\n\r\n        \t\t\r\n\t\t\tfunction initialize() {\r\n\t\t\t\tvar LAT = " . $LAT . ";\r\n\t\t\t\tvar LON = " . $LON . ";\r\n\r\n\t\t\t\tvar latLng = new google.maps.LatLng(LAT, LON);\r\n\t\t\t\tmap = new google.maps.Map(document.getElementById('mapCanvas'), {\r\n\t\t\t\t\r\n\t\t\t\tzoom: " . $this->zoom . ",\r\n\t\t\t\tcenter: latLng,\r\n\t\t\t\tpanControl: false,\r\n\t\t\t\tstreetViewControl: false,\r\n\t\t\t\tzoomControlOptions: {\r\n\t\t\t\t\tstyle: google.maps.ZoomControlStyle.SMALL\r\n\t\t\t\t},\r\n\t\t\t\tmapTypeId: google.maps.MapTypeId.ROADMAP\r\n\t\t\t\t});\r\n\r\n\t\t\t\tinfoWindow = new google.maps.InfoWindow;\r\n\t\t\t\t\r\n\t\t\t\tvar infoBoxOptions = {\r\n\t\t\t\t\tdisableAutoPan: false\r\n\t\t\t\t\t,maxWidth: 0\r\n\t\t\t\t\t,pixelOffset: new google.maps.Size(-100, 0)\r\n\t\t\t\t\t,zIndex: null\r\n\t\t\t\t\t,boxStyle: { \r\n\t\t\t\t\t  background: \"url(" . JURI::base() . 'components/com_improvemycity/images/tipbox.gif' . ") -40px 0 no-repeat\"\r\n\t\t\t\t\t  ,opacity: 0.75\r\n\t\t\t\t\t  ,width: \"200px\"\r\n\t\t\t\t\t }\r\n\t\t\t\t\t,closeBoxMargin: \"10px 2px 2px 2px\"\r\n\t\t\t\t\t,closeBoxURL: \"https://www.google.com/intl/en_us/mapfiles/close.gif\"\r\n\t\t\t\t\t,infoBoxClearance: new google.maps.Size(1, 1)\r\n\t\t\t\t\t,isHidden: false\r\n\t\t\t\t\t,pane: \"floatPane\"\r\n\t\t\t\t\t,enableEventPropagation: false\r\n\t\t\t\t};\r\n\t\t\t\tinfoBox = new InfoBox(infoBoxOptions);\t\t\t\t\r\n\r\n\t\t\t\tfor (var i = 0; i < jsonMarkers.length; i++) {\r\n\t\t\t\t\tvar name = jsonMarkers[i].name;\r\n\t\t\t\t\tvar description = jsonMarkers[i].description;\r\n\t\t\t\t\tvar catid = jsonMarkers[i].catid;\r\n\t\t\t\t\tvar id = jsonMarkers[i].id;\r\n\t\t\t\t\t//var photos = markers[i].photos;\r\n\t\t\t\t\t\r\n\r\n\t\t\t\t\tvar point = new google.maps.LatLng(\r\n\t\t\t\t\t\tparseFloat(jsonMarkers[i].lat),\r\n\t\t\t\t\t\tparseFloat(jsonMarkers[i].lng)\r\n\t\t\t\t\t);\r\n\r\n\r\n\t\t\t\t\tvar html = '<strong>' + name + '</strong>';\r\n\t\t\t\t\tvar icon = customIcons[catid] || {};\r\n\t\t\t\t\tvar marker = new google.maps.Marker({\r\n\t\t\t\t\t\tmap: map,\r\n\t\t\t\t\t\tposition: point,\r\n\t\t\t\t\t\ttitle: name,\r\n\t\t\t\t\t\ticon: icon.icon,\r\n\t\t\t\t\t\tshadow: icon.shadow\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\tmarker.catid = catid;\r\n\t\t\t\t\tmarker.id = id;\r\n\t\t\t\t\t//marker.photos = photos;\r\n\t\t\t\t\t\r\n\t\t\t\t\tmarker.description = description;\r\n\t\t\t\t\t\r\n\t\t\t\t\t//bindInfoWindow(marker, map, infoWindow, html);\r\n\t\t\t\t\tbindInfoBox(marker, map, infoBox, html);\r\n\t\t\t\t\t\r\n\t\t\t\t\tgmarkers.push(marker);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tresetBounds();\r\n\r\n\t\t\t\t\r\n\t\t\t\tjImc(\"#loading\").hide();\r\n\t\t\t}\r\n\r\n\t\t\tfunction bindInfoWindow(marker, map, infoWindow, html) {\r\n\t\t\t  google.maps.event.addListener(marker, 'click', function() {\r\n\t\t\t\tinfoWindow.setContent(html);\r\n\t\t\t\tinfoWindow.open(map, marker);\r\n\t\t\t\tmap.panTo(marker.getPosition());\r\n\t\t\t\t//showInfo(marker);\r\n\t\t\t  });\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//alternative to infoWindow is the infoBox\r\n\t\t\tfunction bindInfoBox(marker, map, infoWindow, html) {\r\n\t\t\t\tvar boxText = document.createElement(\"div\");\r\n\t\t\t\tboxText.style.cssText = \"border: 1px solid black; margin-top: 8px; background-color: yellow; padding: 5px;\";\r\n\t\t\t\tboxText.innerHTML = html;\t\t\t\r\n\t\t\r\n\t\t\t\tgoogle.maps.event.addListener(marker, 'click', function() {\r\n\t\t\t\t\twindow.location.href = '" . ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity&view=issue&issue_id=') . "' + marker.id;\r\n\t\t\t\t});\r\n\t\t\t  \r\n\t\t\t\tgoogle.maps.event.addListener(marker, 'mouseover', function() {\r\n\t\t\t\t\tinfoBox.setContent(boxText);\r\n\t\t\t\t\tinfoBox.open(map, marker);\r\n\t\t\t\t\tjImc(\"#issueid-\"+marker.id).addClass(\"imc-highlight\");\r\n\t\t\t\t});\t\t\t  \r\n\t\t\t\t\r\n\t\t\t\tgoogle.maps.event.addListener(marker, 'mouseout', function() {\r\n\t\t\t\t\tinfoBox.close();\r\n\t\t\t\t\tjImc(\"#issueid-\"+marker.id).removeClass(\"imc-highlight\");\r\n\t\t\t\t});\t\t\t  \r\n\t\t\t}\t\t\t\r\n\t\t\t\r\n\t\t\tfunction downloadUrl(url, callback) {\r\n\t\t\t  var request = window.ActiveXObject ?\r\n\t\t\t\t  new ActiveXObject('Microsoft.XMLHTTP') :\r\n\t\t\t\t  new XMLHttpRequest;\r\n\r\n\t\t\t  request.onreadystatechange = function() {\r\n\t\t\t\tif (request.readyState == 4) {\r\n\t\t\t\t  request.onreadystatechange = doNothing;\r\n\t\t\t\t  callback(request, request.status);\r\n\t\t\t\t  resetBounds();\r\n\t\t\t\t}\r\n\t\t\t  };\r\n\r\n\t\t\t  request.open('GET', url, true);\r\n\t\t\t  request.send(null);\r\n\t\t\t}\r\n\r\n\t\t\tfunction doNothing() {}\r\n\t\t\t\r\n\t\t\tfunction resetBounds() {\r\n\t\t\t\tvar a = 0;\r\n\t\t\t\tbounds = null;\r\n\t\t\t\tbounds = new google.maps.LatLngBounds();\r\n\t\t\t\tfor (var i=0; i<gmarkers.length; i++) {\r\n\t\t\t\t\tif(gmarkers[i].getVisible()){\r\n\t\t\t\t\t\ta++;\r\n\t\t\t\t\t\tbounds.extend(gmarkers[i].position);\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(a > 0){\r\n\t\t\t\t\tmap.fitBounds(bounds);\r\n\t\t\t\t\tvar listener = google.maps.event.addListener(map, 'idle', function() { \r\n\t\t\t\t\t  if (map.getZoom() > 16) map.setZoom(16); \r\n\t\t\t\t\t  google.maps.event.removeListener(listener); \r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//show markers according to filtering\r\n\t\t\tfunction show(category) {\r\n\t\t\t\t// == check the checkbox ==\r\n\t\t\t\tdocument.getElementById('cat-'+category).checked = true;\r\n\t\t\t}\t\t\t\r\n\t\t\t\r\n\t\t\tfunction hide(category) {\r\n\t\t\t\t// == clear the checkbox ==\r\n\t\t\t\tdocument.getElementById('cat-'+category).checked = false;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//--- non recursive since IE cannot handle it (doh!!)\r\n\t\t\tfunction boxclick2(box, category) {\r\n\t\t\t\tif (box.checked) {\r\n\t\t\t\t\tshow(category);\r\n\t\t\t\t} else {\r\n\t\t\t\t\thide(category);\t\r\n\t\t\t\t}\r\n\t\t\t\tvar com = box.getAttribute('path');\r\n\t\t\t\tvar arr = new Array();\r\n\t\t\t\tarr = document.getElementsByName('cat[]');\r\n\t\t\t\tfor(var i = 0; i < arr.length; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar obj = document.getElementsByName('cat[]').item(i);\r\n\t\t\t\t\tvar c = obj.id.substr(4, obj.id.length);\r\n\r\n\t\t\t\t\tvar path = obj.getAttribute('path');\r\n\t\t\t\t\tif(com == path.substring(0,com.length)){\r\n\t\t\t\t\t\tif (box.checked) {\r\n\t\t\t\t\t\t\tobj.checked = true;\r\n\t\t\t\t\t\t\tshow(c);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tobj.checked = false;\r\n\t\t\t\t\t\t\thide(c);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}\t\t\t\r\n\t\t\t\r\n\t\t\tfunction markerclick(i) {\r\n\t\t\t\tgoogle.maps.event.trigger(gmarkers[i],'click');\r\n\t\t\t}\t\t\t\r\n\r\n\t\t\tfunction markerhover(id) {\r\n\t\t\t\tvar index;\r\n\t\t\t\tfor (var i=0; i<gmarkers.length; i++) {\t\t\t\t\r\n\t\t\t\t\tif(gmarkers[i].id == id){\r\n\t\t\t\t\t\tindex = i;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tgoogle.maps.event.trigger(gmarkers[index],'mouseover');\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfunction markerout(id) {\r\n\t\t\t\tvar index;\r\n\t\t\t\tfor (var i=0; i<gmarkers.length; i++) {\t\t\t\t\r\n\t\t\t\t\tif(gmarkers[i].id == id){\r\n\t\t\t\t\t\tindex = i;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tgoogle.maps.event.trigger(gmarkers[index],'mouseout');\r\n\r\n\t\t\t}\t\t\t\r\n\t\t\t\r\n\t\t\t// Onload handler to fire off the app.\r\n\t\t\t//google.maps.event.addDomListener(window, 'load', initialize);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t";
     $documentReady = "\r\n\t\t\r\n\t\tjImc(document).ready(function() {\r\n\t\t\t\t\t\r\n\t\t\tinitialize();\r\n\t\t\t\t\t\r\n\t\t\tjImc(\".imc-issue-item\").mouseenter(function(event)\r\n\t\t\t{\r\n\t\t\tjImc(this).addClass(\"imc-highlight\");\r\n\t\t\tmarkerhover(jImc(this).attr('id').substring(8));\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tjImc(\".imc-issue-item\").mouseleave(function(event)\r\n\t\t\t{\r\n\t\t\tjImc(this).removeClass(\"imc-highlight\");\r\n\t\t\tmarkerout(jImc(this).attr('id').substring(8));\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tjImc(document).click(function(e) {\r\n\t\t\tif( jImc('#drop-1').is('.hover')) { jImc('#drop-1').removeClass('hover');\t}\r\n\t\t\tif( jImc('#drop-2').is('.hover')) { jImc('#drop-2').removeClass('hover');\t}\r\n\t\t\tif( jImc('#drop-3').is('.hover')) { jImc('#drop-3').removeClass('hover');\t}\r\n\t\t\t});\r\n\t\t\t\t\r\n\t\t\tjImc('#btn-1').click(function(event)\r\n\t\t\t{\r\n\t\t\tif( jImc('#drop-2').is('.hover')) { jImc('#btn-2').click(); }\r\n\t\t\tif( jImc('#drop-3').is('.hover')) { jImc('#btn-3').click(); }\r\n\t\t\t\r\n\t\t\tif( jImc('#drop-1').is('.hover')) {\r\n\t\t\t\tjImc('#drop-1').removeClass('hover');\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tjImc('#drop-1').addClass('hover');\r\n\t\t\t}\r\n\t\t\tevent.stopPropagation();\r\n\t\t\t});\r\n\t\t\t\t\r\n\t\t\tjImc('#btn-2').click(function(event)\r\n\t\t\t{\r\n\t\t\tif( jImc('#drop-1').is('.hover')) { jImc('#btn-1').click(); }\r\n\t\t\tif( jImc('#drop-3').is('.hover')) { jImc('#btn-3').click(); }\r\n\t\t\t\t\r\n\t\t\tif( jImc('#drop-2').is('.hover')) {\r\n\t\t\t\tjImc('#drop-2').removeClass('hover');\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tjImc('#drop-2').addClass('hover');\r\n\t\t\t}\r\n\t\t\tevent.stopPropagation();\r\n\t\t\t});\r\n\t\t\tjImc('#btn-3').click(function(event)\r\n\t\t\t{\r\n\t\t\tif( jImc('#drop-1').is('.hover')) { jImc('#btn-1').click(); }\r\n\t\t\tif( jImc('#drop-2').is('.hover')) { jImc('#btn-2').click(); }\r\n\t\t\t\t\r\n\t\t\tif( jImc('#drop-3').is('.hover')) {\r\n\t\t\t\tjImc('#drop-3').removeClass('hover');\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tjImc('#drop-3').addClass('hover');\r\n\t\t\t}\r\n\t\t\tevent.stopPropagation();\r\n\t\t\t});\r\n\t\t\t\t\r\n\t\t\tjImc('.megadrop').click(function(event) { event.stopPropagation();\t});\r\n\t\t\t\r\n\t\t});\r\n\t\t";
     $document->addScriptDeclaration($googleMap);
     $document->addScriptDeclaration($documentReady);
 }
示例#4
0
	<?php 
/* <h2 class="issue-title"><?php echo JText::_('NEW_ISSUE');?></h2> */
?>
	
	<div id="imc-header">
		<div id="imc-menu">
			<h2 class="imc-title"><?php 
echo JText::_('NEW_ISSUE');
?>
</h2>
			<!-- bootstrap buttons -->	
			
			<!-- Return to issues -->
			<div class="btn-group imc-right">
				<a class="btn" href="<?php 
echo ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity');
?>
"><i class="icon-arrow-left"></i> <?php 
echo JText::_('RETURN_TO_ISSUES');
?>
</a>
			</div>
		
		</div>
	</div>	
	<div id="imc-content">
		<div id="imc-main-panel">
			<div id="mapCanvasNew"><?php 
echo JText::_('COM_IMPROVEMYCITY');
?>
</div>
示例#5
0
 private function notifyByEmail($id, $data)
 {
     // Load the parameters.
     $app = JFactory::getApplication();
     $par = $app->getParams();
     $this->mailNewIssueAdmins = $par->get('mailnewissueadmins');
     $this->mailNewIssueUser = $par->get('mailnewissueuser');
     //get the link to the newly created issue
     $issueLink = 'http://' . $_SERVER['HTTP_HOST'] . ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity&view=issue&issue_id=' . $id);
     //$issueAdminLink = JURI::root() . 'administrator/' . 'index.php?option=com_improvemycity&view=issue&layout=edit&id='.$table->id;
     /*fixing "You are not permitted to use that link to directly access that page"*/
     $issueAdminLink = JURI::root() . 'administrator/' . 'index.php?option=com_improvemycity&view=issue&task=issue.edit&id=' . $id;
     $user = JFactory::getUser($data['userid']);
     $app = JFactory::getApplication();
     $mailfrom = $app->getCfg('mailfrom');
     $fromname = $app->getCfg('fromname');
     $sitename = $app->getCfg('sitename');
     /* (A) ****--- Send notification mail to appropriate admins (as defined on category note field) */
     if ($this->mailNewIssueAdmins == 1) {
         //get the recipient email(s) as defined in the "note" field of the selected category
         $issueRecipient = '';
         $db = $this->getDbo();
         $query = $db->getQuery(true);
         $query->select('a.note as note, a.title as title');
         $query->from('`#__categories` AS a');
         $query->where('a.id = ' . $data['catid']);
         $db->setQuery($query);
         //$result = $db->loadResult();
         $row = $db->loadAssoc();
         if (!empty($row)) {
             $issueRecipient = $row['note'];
             $arRecipient = explode(";", $issueRecipient);
             $arRecipient = array_filter($arRecipient, 'strlen');
             $categoryTitle = $row['title'];
         }
         if (!empty($issueRecipient)) {
             //only if category note contains email(s)
             $subject = sprintf(JText::_('COM_IMPROVEMYCITY_MAIL_ADMINS_NEW_ISSUE_SUBJECT'), $user->name, $user->email);
             $body = sprintf(JText::_('COM_IMPROVEMYCITY_MAIL_ADMINS_NEW_ISSUE_BODY'), $categoryTitle, $data['title'], $data['address'], $issueLink, $issueLink, $issueAdminLink, $issueAdminLink);
             $mail = JFactory::getMailer();
             $mail->isHTML(true);
             $mail->Encoding = 'base64';
             foreach ($arRecipient as $recipient) {
                 $mail->addRecipient($recipient);
             }
             $mail->setSender(array($mailfrom, $fromname));
             $mail->setSubject($sitename . ': ' . $subject);
             $mail->setBody($body);
             $sent = $mail->Send();
         }
     }
     /* (B) ****---   Send notification mail to the user who submitted the issue */
     if ($this->mailNewIssueUser == 1) {
         // recipient is the user
         $issueRecipient = $user->email;
         if ($issueRecipient != '') {
             //check just in case...
             $subject = JText::_('COM_IMPROVEMYCITY_MAIL_USER_NEW_ISSUE_SUBJECT');
             $body = sprintf(JText::_('COM_IMPROVEMYCITY_MAIL_USER_NEW_ISSUE_BODY'), $issueLink, $issueLink);
             $mail = JFactory::getMailer();
             $mail->isHTML(true);
             $mail->Encoding = 'base64';
             $mail->addRecipient($issueRecipient);
             $mail->setSender(array($mailfrom, $fromname));
             $mail->setSubject($sitename . ': ' . $subject);
             $mail->setBody($body);
             $sent = $mail->Send();
             //also inform user at the frontend for the email that is about to receive
             JFactory::getApplication()->enqueueMessage(JText::_('COM_IMPROVEMYCITY_NEW_ISSUE_SAVE_SUCCESS'));
         }
     }
     return true;
 }
示例#6
0
 public function commentNotificationMail($pk = 0, $userid = 0, $description = '')
 {
     // Initialise variables (populate state is not called from json calls).
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $this->mailNewCommentAdmins = $params->get('mailnewcommentadmins');
     $this->mailNewCommentUser = $params->get('mailnewcommentuser');
     //send notification mail to the category admin
     //get the link to the commented issue
     $issueLink = 'http://' . $_SERVER['HTTP_HOST'] . ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity&view=issue&issue_id=' . $pk);
     //$issueAdminLink = JURI::root() . 'administrator/' . 'index.php?option=com_improvemycity&view=issue&layout=edit&id='.$table->id;
     /*fixing "You are not permitted to use that link to directly access that page"*/
     $issueAdminLink = JURI::root() . 'administrator/' . 'index.php?option=com_improvemycity&view=issue&task=issue.edit&id=' . $pk;
     $user = JFactory::getUser($userid);
     $app = JFactory::getApplication();
     $mailfrom = $app->getCfg('mailfrom');
     $fromname = $app->getCfg('fromname');
     $sitename = $app->getCfg('sitename');
     /* (A) ****--- Send notification mail to appropriate admin (as defined on category) */
     if ($this->mailNewCommentAdmins == 1) {
         //get the catid of the issue
         $catid = 0;
         $db = $this->getDbo();
         $query = $db->getQuery(true);
         $query->select('a.catid, a.userid');
         $query->from('`#__improvemycity` AS a');
         $query->where('a.id = ' . (int) $pk);
         $db->setQuery($query);
         //$catid = $db->loadResult();
         $row = $db->loadAssoc();
         $catid = $row['catid'];
         $initialUser = JFactory::getUser($row['userid']);
         //get the recipient email(s) as defined in the "note" field of the selected category
         $issueRecipient = '';
         $db = $this->getDbo();
         $query = $db->getQuery(true);
         $query->select('a.note as note, a.title as title');
         $query->from('`#__categories` AS a');
         $query->where('a.id = ' . (int) $catid);
         $db->setQuery($query);
         //$result = $db->loadResult();
         $row = $db->loadAssoc();
         if (!empty($row)) {
             $issueRecipient = $row['note'];
             $arRecipient = explode(";", $issueRecipient);
             $arRecipient = array_filter($arRecipient, 'strlen');
             $categoryTitle = $row['title'];
         }
         if (!empty($issueRecipient)) {
             //only if category note contains email(s)
             $subject = sprintf(JText::_('COM_IMPROVEMYCITY_MAIL_ADMINS_NEW_COMMENT_SUBJECT'), $user->name, $user->email);
             $body = sprintf(JText::_('COM_IMPROVEMYCITY_MAIL_ADMINS_NEW_COMMENT_BODY'), $categoryTitle, $description, $issueLink, $issueLink, $issueAdminLink, $issueAdminLink);
             $mail = JFactory::getMailer();
             $mail->isHTML(true);
             $mail->Encoding = 'base64';
             foreach ($arRecipient as $recipient) {
                 $mail->addRecipient($recipient);
             }
             $mail->setSender(array($mailfrom, $fromname));
             $mail->setSubject($sitename . ': ' . $subject);
             $mail->setBody($body);
             $sent = $mail->Send();
         }
     }
     /* (B) ****--- Send notification mail to issue submitter */
     if ($this->mailNewCommentUser == 1) {
         $issueRecipient = $initialUser->email;
         if ($issueRecipient != '') {
             //check just in case...
             $subject = JText::_('COM_IMPROVEMYCITY_MAIL_USER_NEW_COMMENT_SUBJECT');
             $body = sprintf(JText::_('COM_IMPROVEMYCITY_MAIL_USER_NEW_COMMENT_BODY'), $description, $issueLink, $issueLink);
             $mail = JFactory::getMailer();
             $mail->isHTML(true);
             $mail->Encoding = 'base64';
             $mail->addRecipient($issueRecipient);
             $mail->setSender(array($mailfrom, $fromname));
             $mail->setSubject($sitename . ': ' . $subject);
             $mail->setBody($body);
             $sent = $mail->Send();
         }
     }
     return true;
 }
示例#7
0
				<div class="alert alert-error width75">
				<?php 
    echo JText::_('COM_IMPROVEMYCITY_FILTER_REVISION');
    ?>
				</div>
			<?php 
}
?>
			<?php 
foreach ($this->items as $item) {
    ?>
				<div class="imc-issue-item" id="issueid-<?php 
    echo $item->id;
    ?>
" onclick="location.href='<?php 
    echo ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity&view=issue&issue_id=' . $item->id);
    ?>
';void(0);" >
					<div class="imc-issue-content">
						<div class="imc-issue-review">
							<h2 class="imc-issue-title">
								<?php 
    echo '#' . $item->id . '. ' . $item->title;
    ?>
								<?php 
    $status = '';
    switch ($item->currentstatus) {
        case 1:
            $status = 'OPEN';
            break;
        case 2: