primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<access component="com_phocamaps">
<section name="component">
<action name="core.admin" title="JAction_Admin" description="JAction_Admin_Component_Desc" />
<action name="core.manage" title="JAction_Manage" description="JAction_Manage_Component_Desc" />
<action name="core.create" title="JAction_Create" description="JAction_Create_Component_Desc" />
<action name="core.delete" title="JAction_Delete" description="JAction_Delete_Component_Desc" />
<action name="core.edit" title="JAction_Edit" description="JAction_Edit_Component_Desc" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JAction_EditState_Component_Desc" />
</section>
</access>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,124 @@
The GNU General Public License (GPL)
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
One line to give the program's name and a brief idea of what it does.
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.

View File

@ -0,0 +1,40 @@
.picker_layer {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
text-decoration: none;
background-color: #d4d0c8;
border-width: 1px;
border-style: solid;
border-color: #666666;
overflow: visible;
height: auto;
width: auto;
}
.picker_buttons {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
background-color:#d4d0c8;
border-style:solid;
border-color:#666666;
border-width:1px;
padding:1px;
cursor:pointer;
color:#000000;
}
.cell_color {
cursor:pointer;
width:9px;
height:9px;
}
.color_table {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
text-decoration: none;
}
.choosed_color_cell{
border-style:solid; border-color:#000000; border-width:1px;
}
.default_color_btn{
width:17px; height:17px; background-image:url(defaultcolor.jpg);
background-repeat:no-repeat; background-position:center;
}

View File

@ -0,0 +1,203 @@
/*
* Gchats color picker by Majid Khosravi
* Copyright (c) 2006 - 2008 Gchat Design Studio
* URL: http://www.gchats.com
* Date: April 24 2008
* Gchats color picker is freely distributable under the terms of GPL license.
* Please visit: http://www.gchats.com for updates
* @Version 1.1
*--------------------------------------------------------------------------*/
// JavaScript Document
var layerWidth = 218;
var layerHeight = 144;
var currentId = "";
var orgColor ="";
function openPicker(id){
currentId = id;
removeLayer("picker");
Obj = document.getElementById(id);
orgColor = Obj.value;
createLayer("picker",findPosX(Obj)+Obj.offsetWidth+20,findPosY(Obj));
}
function createLayer(id,left,top){
var width = layerWidth;
var height = layerHeight;
var zindex = 1000;
var bgcolor = "#d4d0c8";
var txtcolor = "#000000";
var msg = getPickerContent();
if (document.layers) {
if (document.layers[id]) {
return;
}
var layer=document.layers[id]=new Layer(width);
layer.className = "picker_layer";
layer.name = id;
layer.left=left;
layer.top=top;
layer.clip.height=height;
layer.visibility = 'show';
layer.zIndex=zindex;
layer.bgColor=bgcolor;
layer.innerHTML = msg;
}else if (document.all) {
if (document.all[id]) {
return
}
var layer= '\n<DIV class="picker_layer" id='+id+' style="position:absolute'
+'; left:'+left+"px"
+'; top:'+top+"px"
+'; width:'+width
+'; height:'+height
+'; visibility:visible'
+'; z-index:'+zindex
+';text-align:left">'
+ msg
+'</DIV>';
document.body.insertAdjacentHTML("BeforeEnd",layer);
}else if(document.getElementById){
var layer = document.createElement ('div');
layer.setAttribute ('id', id);
document.body.appendChild (layer);
var ly = document.getElementById(id);
ly.className = "picker_layer";
ly.style.position= "absolute";
ly.style.left= left+"px";
ly.style.top= top+ "px";
ly.style.width= width+ "px";
ly.style.height= height+ "px";
ly.style.textAlign= "left";
ly.innerHTML = msg;
}
}
function showClr(color){
Obj = document.getElementById(currentId);
Obj.value = color;
Obj.style.backgroundColor=color;
Obj = document.getElementById("gcpicker_colorSample");
Obj.style.backgroundColor=color;
Obj = document.getElementById("gcpicker_colorCode");
Obj.innerHTML = color;
}
function setClr(color){
Obj = document.getElementById(currentId);
Obj.value = color;
Obj.style.backgroundColor=color;
currentId = "";
removeLayer("picker");
}
function cancel(){
Obj = document.getElementById(currentId);
Obj.value = '';
Obj.style.backgroundColor='';
removeLayer("picker");
}
function removeLayer(id){
if(document.getElementById(id) ==null){
return;
}
if (document.layers && document.layers[id]) {
document.layers[id].visibility='hide'
delete document.layers[id]
}
if (document.all && document.all[id]) {
document.all[id].innerHTML=''
document.all[id].outerHTML=''
}else if(document.getElementById){
var b = document.body;
var layer = document.getElementById(id);
b.removeChild(layer);
}
}
function getPickerContent(){
var content = '<table width="222" border="0" cellpadding="0" cellspacing="1"><tr><td>';
content += '<table width="100%" border="0" cellpadding="0" cellspacing="1" class="color_table"><tr><td bgcolor="#CCCCCC" id="gcpicker_colorSample" width="40px" class="choosed_color_cell">&nbsp;</td><td align="center"><div id="gcpicker_colorCode">#CCCCCC</div></td><td width="60px" align="center"><input type="submit" value="" onclick="cancel()" class="default_color_btn" /></td></tr></table>';
content += '</td></tr><tr><td>';
content += colorTable()+'</td></tr></table>';
return content;
}
function colorTable(){
var clrfix = Array("#000000","#333333","#666666","#999999","#cccccc","#ffffff","#ff0000","#00ff00","#0000ff","#ffff00","#00ffff","#ff00ff");
var table ='<table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000"><tr>';
table += '';
for(var j=0;j<3;j++){
table += '<td width="11"><table bgcolor="#000000" border="0" cellpadding="0" cellspacing="1" class="color_table">';
for(var i=0;i<12;i++){
var clr ='#000000';
if(j==1){
clr = clrfix[i];
}
table += '<tr><td bgcolor="'+clr+'" class="cell_color" onmouseover="showClr('+"'"+clr+"'"+')" onclick="setClr('+"'"+clr+"'"+')"></td></tr>';
}
table += '</table></td>';
}
table +='<td><table border="0" cellpadding="0" cellspacing="0">';
for (var c = 0; c<6; c++) {
if(c==0 || c==3){
table +="<tr>";
}
table += "<td>"
table = table+'<table border="0" cellpadding="0" cellspacing="1" class="color_table"> ';
for (var j = 0; j<6; j++) {
table +="<tr>";
for (var i = 0; i<6; i++) {
var clrhex = rgb2hex(j*255/5,i*255/5,c*255/5);
table += '<td bgcolor="'+clrhex+'" class="cell_color" onmouseover="showClr('+"'"+clrhex+"'"+')" onclick="setClr('+"'"+clrhex+"'"+')"></td>';
}
table +="</tr>";
}
table +="</table>";
table += "</td>"
if(c==2 || c==5){
table +="</tr>";
}
}
table +='</table></td></tr></table>';
return table;
}
function findPosX(obj){
var curleft = 0;
if(obj.offsetParent)
while(1){
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(obj){
var curtop = 0;
if(obj.offsetParent){
while(1){
curtop += obj.offsetTop;
if(!obj.offsetParent){
break;
}
obj = obj.offsetParent;
}
}else if(obj.y){
curtop += obj.y;
}
return curtop;
}
function rgb2hex(red, green, blue)
{
var decColor = red + 256 * green + 65536 * blue;
var clr = decColor.toString(16);
for(var i =clr.length;i<6;i++){
clr = "0"+clr;
}
return "#"+clr;
}

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fields addfieldpath="/administrator/components/com_phocamaps/models/fields">
<fieldset name="general" label="COM_PHOCAMAPS_CONFIG_HEAD_GENERAL_LABEL">
<field name="map_type" type="list" default="2" label="COM_PHOCAMAPS_FIELD_MAP_TYPE_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_TYPE_DESC">
<option value="1">COM_PHOCAMAPS_GOOGLE_MAPS</option>
<option value="2">COM_PHOCAMAPS_OPENSTREETMAP</option>
</field>
<field name="marker_clustering" type="radio" class="btn-group btn-group-yesno" default="0" label="COM_PHOCAMAPS_FIELD_MARKER_CLUSTERING_LABEL" description="COM_PHOCAMAPS_FIELD_MARKER_CLUSTERING_DESC">
<option value="0">COM_PHOCAMAPS_NO</option>
<option value="1">COM_PHOCAMAPS_YES</option>
</field>
</fieldset>
<fieldset name="googlemaps" label="COM_PHOCAMAPS_CONFIG_HEAD_GOOGLE_MAPS_LABEL">
<field name="enable_kml" type="radio" class="btn-group btn-group-yesno" default="0" label="COM_PHOCAMAPS_FIELD_ENABLE_KML_FILE_LOADING_LABEL" description="COM_PHOCAMAPS_FIELD_ENABLE_KML_FILE_LOADING_DESC">
<option value="0">COM_PHOCAMAPS_NO</option>
<option value="1">COM_PHOCAMAPS_YES</option>
</field>
<field name="display_print_route" type="radio" class="btn-group btn-group-yesno" default="1" label="COM_PHOCAMAPS_FIELD_DISPLAY_PRINT_ROUTE_LABEL" description="COM_PHOCAMAPS_FIELD_DISPLAY_PRINT_ROUTE_DESC">
<option value="0">COM_PHOCAMAPS_NO</option>
<option value="1">COM_PHOCAMAPS_YES</option>
</field>
<field name="enable_cache" type="radio" class="btn-group btn-group-yesno" default="0" label="COM_PHOCAMAPS_FIELD_ENABLE_CACHE_LABEL" description="COM_PHOCAMAPS_FIELD_ENABLE_CACHE_DESC">
<option value="1">COM_PHOCAMAPS_YES</option>
<option value="0">COM_PHOCAMAPS_NO</option>
</field>
<field name="close_opened_window" type="radio" class="btn-group btn-group-yesno" default="0" label="COM_PHOCAMAPS_FIELD_CLOSE_OPENED_WINDOW_LABEL" description="COM_PHOCAMAPS_FIELD_CLOSE_OPENED_WINDOW_DESC">
<option value="1">COM_PHOCAMAPS_YES</option>
<option value="0">COM_PHOCAMAPS_NO</option>
</field>
<field name="load_api_ssl" type="radio" class="btn-group btn-group-yesno" default="1" label="COM_PHOCAMAPS_FIELD_LOAD_API_SSL_LABEL" description="COM_PHOCAMAPS_FIELD_LOAD_API_SSL_DESC">
<option value="1">COM_PHOCAMAPS_YES</option>
<option value="0">COM_PHOCAMAPS_NO</option>
</field>
<field name="maps_api_key" default="" type="text" label="COM_PHOCAMAPS_FIELD_MAPS_API_KEY_LABEL" description="COM_PHOCAMAPS_FIELD_MAPS_API_KEY_DESC"/>
</fieldset>
<fieldset name="openstreet" label="COM_PHOCAMAPS_CONFIG_HEAD_OPENSTREETMAP_LABEL">
<field name="osm_map_type" type="list" default="osm" label="COM_PHOCAMAPS_FIELD_OSM_MAP_TYPE_OSM_LABEL" description="COM_PHOCAMAPS_FIELD_OSM_MAP_TYPE_OSM_DESC">
<option value="osm">COM_PHOCAMAPS_OPENSTREETMAP</option>
<option value="osm_bw">COM_PHOCAMAPS_OPENSTREETMAP_BLACK_WHITE</option>
<option value="osm_de">COM_PHOCAMAPS_OPENSTREETMAP_GERMANY</option>
<option value="osm_fr">COM_PHOCAMAPS_OPENSTREETMAP_FRANCE</option>
<option value="osm_hot">COM_PHOCAMAPS_HUMANITARIAN_OPENSTREETMAP</option>
<option value="thunderforest">COM_PHOCAMAPS_THUNDERFOREST_API_KEY_NEEDED</option>
<option value="mapbox">COM_PHOCAMAPS_MAPBOX_API_KEY_NEEDED</option>
<option value="opentopomap">COM_PHOCAMAPS_OPENTOPOMAP</option>
<option value="wikimedia">COM_PHOCAMAPS_WIKIMEDIA_MAPS</option>
</field>
<field name="thunderforest_map_type" default="" type="text" label="COM_PHOCAMAPS_FIELD_THUNDERFOREST_MAP_TYPE_OSM_LABEL" description="COM_PHOCAMAPS_FIELD_THUNDERFOREST_MAP_TYPE_OSM_DESC"/>
<field name="osm_zoom_control" type="radio" class="btn-group btn-group-yesno" default="1" label="COM_PHOCAMAPS_FIELD_ENABLE_ZOOM_CONTROL_BUTTON_LABEL" description="COM_PHOCAMAPS_FIELD_ENABLE_ZOOM_CONTROL_BUTTON_DESC">
<option value="1">COM_PHOCAMAPS_YES</option>
<option value="0">COM_PHOCAMAPS_NO</option>
</field>
<field name="osm_zoom_wheel" type="radio" class="btn-group btn-group-yesno" default="1" label="COM_PHOCAMAPS_FIELD_ENABLE_MOUSE_WHEEL_ZOOM_LABEL" description="COM_PHOCAMAPS_FIELD_ENABLE_MOUSE_WHEEL_ZOOM_DESC">
<option value="1">COM_PHOCAMAPS_YES</option>
<option value="0">COM_PHOCAMAPS_NO</option>
</field>
<field name="osm_current_position" type="radio" class="btn-group btn-group-yesno" default="1" label="COM_PHOCAMAPS_FIELD_DISPLAY_CURRENT_POSITION_BUTTON_LABEL" description="COM_PHOCAMAPS_FIELD_DISPLAY_CURRENT_POSITION_BUTTON_DESC">
<option value="1">COM_PHOCAMAPS_YES</option>
<option value="0">COM_PHOCAMAPS_NO</option>
</field>
<field name="osm_full_screen" type="radio" class="btn-group btn-group-yesno" default="1" label="COM_PHOCAMAPS_FIELD_DISPLAY_FULL_SCREEN_BUTTON_LABEL" description="COM_PHOCAMAPS_FIELD_DISPLAY_FULL_SCREEN_BUTTON_DESC">
<option value="1">COM_PHOCAMAPS_YES</option>
<option value="0">COM_PHOCAMAPS_NO</option>
</field>
<field name="osm_search" type="radio" class="btn-group btn-group-yesno" default="0" label="COM_PHOCAMAPS_FIELD_DISPLAY_SEARCH_BUTTON_LABEL" description="COM_PHOCAMAPS_FIELD_DISPLAY_SEARCH_BUTTON_DESC">
<option value="1">COM_PHOCAMAPS_YES</option>
<option value="0">COM_PHOCAMAPS_NO</option>
</field>
<field name="osm_easyprint" type="radio" class="btn-group btn-group-yesno" default="0" label="COM_PHOCAMAPS_FIELD_DISPLAY_PRINT_BUTTON_BUTTON_LABEL" description="COM_PHOCAMAPS_FIELD_DISPLAY_PRINT_BUTTON_BUTTON_DESC">
<option value="1">COM_PHOCAMAPS_YES</option>
<option value="0">COM_PHOCAMAPS_NO</option>
</field>
<field name="phocahead1" type="phocahead" default="COM_PHOCAMAPS_ROUTING_SETTINGS_LABEL" label="" description=""/>
<field name="osm_router" type="radio" class="btn-group btn-group-yesno" default="0" label="COM_PHOCAMAPS_FIELD_ENABLE_ROUTING_OSM_LABEL" description="COM_PHOCAMAPS_FIELD_ENABLE_ROUTING_OSM_DESC">
<option value="1">COM_PHOCAMAPS_YES</option>
<option value="0">COM_PHOCAMAPS_NO</option>
</field>
<field name="osm_router_profile" default="" type="text" label="COM_PHOCAMAPS_FIELD_MAP_ROUTER_PROFILE_OSM_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_ROUTER_PROFILE_OSM_DESC"/>
<field name="osm_router_routerserviceurl" default="" type="text" label="COM_PHOCAMAPS_FIELD_MAP_ROUTER_SERVICE_URL_OSM_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_ROUTER_SERVICE_URL_OSM_DESC"/>
<field name="osm_map_router_api_key" default="" type="text" label="COM_PHOCAMAPS_FIELD_MAP_ROUTER_API_KEY_OSM_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_ROUTER_API_KEY_OSM_DESC"/>
<field name="osm_map_router_type" type="list" default="" label="COM_PHOCAMAPS_FIELD_OSM_MAP_ROUTER_TYPE_OSM_LABEL" description="COM_PHOCAMAPS_FIELD_OSM_MAP_ROUTER_TYPE_OSM_DESC">
<option value="">COM_PHOCAMAPS_NONE</option>
<option value="mapbox">COM_PHOCAMAPS_MAPBOX_API_KEY_NEEDED</option>
</field>
</fieldset>
<fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" description="JCONFIG_PERMISSIONS_DESC">
<field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" filter="rules" validate="rules" component="com_phocamaps" section="component"/>
</fieldset>
</fields>
</config>

View File

@ -0,0 +1,54 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\Helpers\Sidebar;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\MVC\Controller\BaseController;
jimport('joomla.application.component.controller');
$app = Factory::getApplication();
$option = $app->input->get('option');
$l['cp'] = array('COM_PHOCAMAPS_CONTROL_PANEL', '');
$l['mp'] = array('COM_PHOCAMAPS_MAPS', 'phocamapsmaps');
$l['mr'] = array('COM_PHOCAMAPS_MARKERS', 'phocamapsmarkers');
$l['mi'] = array('COM_PHOCAMAPS_ICONS', 'phocamapsicons');
$l['in'] = array('COM_PHOCAMAPS_INFO', 'phocamapsinfo');
// Submenu view
$view = Factory::getApplication()->input->get('view');
$layout = Factory::getApplication()->input->get('layout');
if ($layout == 'edit') {
} else {
foreach ($l as $k => $v) {
if ($v[1] == '') {
$link = 'index.php?option='.$option;
} else {
$link = 'index.php?option='.$option.'&view=';
}
if ($view == $v[1]) {
Sidebar::addEntry(Text::_($v[0]), $link.$v[1], true );
} else {
Sidebar::addEntry(Text::_($v[0]), $link.$v[1]);
}
}
}
class phocaMapsCpController extends BaseController
{
function display($cachable = false, $urlparams = array()) {
parent::display($cachable, $urlparams);
}
}
?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,46 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Factory;
jimport('joomla.application.component.controllerform');
class PhocaMapsCpControllerPhocaMapsIcon extends FormController
{
protected $option = 'com_phocamaps';
function __construct($config=array()) {
parent::__construct($config);
}
protected function allowAdd($data = array()) {
$user = Factory::getUser();
$allow = null;
$allow = $user->authorise('core.create', 'com_phocamaps');
if ($allow === null) {
return parent::allowAdd($data);
} else {
return $allow;
}
}
protected function allowEdit($data = array(), $key = 'id') {
$user = Factory::getUser();
$allow = null;
$allow = $user->authorise('core.edit', 'com_phocamaps');
if ($allow === null) {
return parent::allowEdit($data, $key);
} else {
return $allow;
}
}
}
?>

View File

@ -0,0 +1,40 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Factory;
jimport('joomla.application.component.controlleradmin');
class PhocaMapsCpControllerPhocaMapsIcons extends AdminController
{
protected $option = 'com_phocamaps';
public function &getModel($name = 'PhocaMapsIcon', $prefix = 'PhocaMapsCpModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}
public function saveOrderAjax() {
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
$pks = $this->input->post->get('cid', array(), 'array');
$order = $this->input->post->get('order', array(), 'array');
ArrayHelper::toInteger($pks);
ArrayHelper::toInteger($order);
$model = $this->getModel();
$return = $model->saveorder($pks, $order);
if ($return) { echo "1";}
Factory::getApplication()->close();
}
}
?>

View File

@ -0,0 +1,17 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die();
class PhocaMapsCpControllerPhocaMapsInfo extends PhocaMapsCpController
{
}
?>

View File

@ -0,0 +1,62 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Router\Route;
jimport('joomla.application.component.controllerform');
class PhocaMapsCpControllerPhocaMapsMap extends FormController
{
protected $option = 'com_phocamaps';
function __construct($config=array()) {
parent::__construct($config);
}
protected function allowAdd($data = array()) {
$user = Factory::getUser();
$allow = null;
$allow = $user->authorise('core.create', 'com_phocamaps');
if ($allow === null) {
return parent::allowAdd($data);
} else {
return $allow;
}
}
protected function allowEdit($data = array(), $key = 'id') {
$user = Factory::getUser();
$allow = null;
$allow = $user->authorise('core.edit', 'com_phocamaps');
if ($allow === null) {
return parent::allowEdit($data, $key);
} else {
return $allow;
}
}
public function batch($model = null) {
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('phocamapsmap', '', array());
// Preset the redirect
$this->setRedirect(Route::_('index.php?option=com_phocamaps&view=phocamapsmaps'.$this->getRedirectToListAppend(), false));
return parent::batch($model);
}
}
?>

View File

@ -0,0 +1,39 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Factory;
jimport('joomla.application.component.controlleradmin');
class PhocaMapsCpControllerPhocaMapsMaps extends AdminController
{
protected $option = 'com_phocamaps';
public function &getModel($name = 'PhocaMapsMap', $prefix = 'PhocaMapsCpModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}
public function saveOrderAjax() {
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
$pks = $this->input->post->get('cid', array(), 'array');
$order = $this->input->post->get('order', array(), 'array');
ArrayHelper::toInteger($pks);
ArrayHelper::toInteger($order);
$model = $this->getModel();
$return = $model->saveorder($pks, $order);
if ($return) { echo "1";}
Factory::getApplication()->close();
}
}
?>

View File

@ -0,0 +1,62 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Router\Route;
jimport('joomla.application.component.controllerform');
class PhocaMapsCpControllerPhocaMapsMarker extends FormController
{
protected $option = 'com_phocamaps';
function __construct($config=array()) {
parent::__construct($config);
}
protected function allowAdd($data = array()) {
$user = Factory::getUser();
$allow = null;
$allow = $user->authorise('core.create', 'com_phocamaps');
if ($allow === null) {
return parent::allowAdd($data);
} else {
return $allow;
}
}
protected function allowEdit($data = array(), $key = 'id') {
$user = Factory::getUser();
$allow = null;
$allow = $user->authorise('core.edit', 'com_phocamaps');
if ($allow === null) {
return parent::allowEdit($data, $key);
} else {
return $allow;
}
}
public function batch($model = null) {
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('phocamapsmarker', '', array());
// Preset the redirect
$this->setRedirect(Route::_('index.php?option=com_phocamaps&view=phocamapsmarkers'.$this->getRedirectToListAppend(), false));
return parent::batch($model);
}
}
?>

View File

@ -0,0 +1,41 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Factory;
jimport('joomla.application.component.controlleradmin');
class PhocaMapsCpControllerPhocaMapsMarkers extends AdminController
{
protected $option = 'com_phocamaps';
public function &getModel($name = 'PhocaMapsMarker', $prefix = 'PhocaMapsCpModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}
public function saveOrderAjax() {
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
$pks = $this->input->post->get('cid', array(), 'array');
$order = $this->input->post->get('order', array(), 'array');
ArrayHelper::toInteger($pks);
ArrayHelper::toInteger($order);
$model = $this->getModel();
$return = $model->saveorder($pks, $order);
if ($return) { echo "1";}
Factory::getApplication()->close();
}
}
?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -0,0 +1,46 @@
<?php defined('_JEXEC') or die;?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_GB" xml:lang="en_GB">
<head>
<title>Phoca Maps</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
font-family: "Roboto", sans, Arial;
}
</style>
</head>
<body>
<h1>Phoca Maps</h1>
<div style="float:right;margin:10px;"><img src="logo-phoca.png" alt="" /></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div><a href="https://www.phoca.cz/project/phocamaps-joomla-maps" target="_blank">Phoca Maps Main Site</a></div>
<p>&nbsp;</p>
<h2>Documentation</h2>
<div><a href="https://www.phoca.cz/documentation/category/53-phoca-maps-component" target="_blank">Documentation</a></div>
<p>&nbsp;</p>
<h2>Support</h2>
<ul>
<li><a href="https://www.phoca.cz/forum" target="_blank">Phoca Forum</a></li>
<li><a href="https://www.phoca.cz/forum/app.php/feed" target="_blank">Phoca Forum RSS</a></li>
</ul>
<p>&nbsp;</p>
<h2>News</h2>
<ul>
<li><a href="https://www.phoca.cz/news" target="_blank">Phoca News</a></li>
<li><a href="https://www.phoca.cz/news?format=feed&type=rss" target="_blank">Phoca News RSS</a></li>
<li><a href="https://www.phoca.cz/download/feed/111?format=feed&type=rss" target="_blank">Phoca Latest Releases RSS</a></li>
</ul>
<p>&nbsp;</p>
<h2>Demo</h2>
<ul>
<li><a href="https://www.phoca.cz/joomla3demo/phoca-maps-demo" target="_blank">Joomla! 3 Demo</a></li>
<li><a href="https://www.phoca.cz/joomlademo/phoca-maps" target="_blank">Joomla! 2.5 Demo</a></li>
<li><a href="https://www.phoca.cz/demo/phoca-maps-demo-component" target="_blank">Joomla! 1.5 Demo</a></li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
<a href="javascript:void(0);" onclick="javascript:window.close();"><span class="small">Close window</span></a>
</body>
</html>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -0,0 +1,46 @@
<?php defined('_JEXEC') or die;?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_GB" xml:lang="en_GB">
<head>
<title>Phoca Maps</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
font-family: "Roboto", sans, Arial;
}
</style>
</head>
<body>
<h1>Phoca Maps</h1>
<div style="float:right;margin:10px;"><img src="logo-phoca.png" alt="" /></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div><a href="https://www.phoca.cz/project/phocamaps-joomla-maps" target="_blank">Phoca Maps Main Site</a></div>
<p>&nbsp;</p>
<h2>Documentation</h2>
<div><a href="https://www.phoca.cz/documentation/category/53-phoca-maps-component" target="_blank">Documentation</a></div>
<p>&nbsp;</p>
<h2>Support</h2>
<ul>
<li><a href="https://www.phoca.cz/forum" target="_blank">Phoca Forum</a></li>
<li><a href="https://www.phoca.cz/forum/app.php/feed" target="_blank">Phoca Forum RSS</a></li>
</ul>
<p>&nbsp;</p>
<h2>News</h2>
<ul>
<li><a href="https://www.phoca.cz/news" target="_blank">Phoca News</a></li>
<li><a href="https://www.phoca.cz/news?format=feed&type=rss" target="_blank">Phoca News RSS</a></li>
<li><a href="https://www.phoca.cz/download/feed/111?format=feed&type=rss" target="_blank">Phoca Latest Releases RSS</a></li>
</ul>
<p>&nbsp;</p>
<h2>Demo</h2>
<ul>
<li><a href="https://www.phoca.cz/joomla3demo/phoca-maps-demo" target="_blank">Joomla! 3 Demo</a></li>
<li><a href="https://www.phoca.cz/joomlademo/phoca-maps" target="_blank">Joomla! 2.5 Demo</a></li>
<li><a href="https://www.phoca.cz/demo/phoca-maps-demo-component" target="_blank">Joomla! 1.5 Demo</a></li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
<a href="javascript:void(0);" onclick="javascript:window.close();"><span class="small">Close window</span></a>
</body>
</html>

View File

@ -0,0 +1,70 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
abstract class PhocaMapsBatch
{
public static function item($published, $category = 0)
{
// Create the copy/move options.
$options = array(
HTMLHelper::_('select.option', 'c', Text::_('JLIB_HTML_BATCH_COPY')),
HTMLHelper::_('select.option', 'm', Text::_('JLIB_HTML_BATCH_MOVE'))
);
$db = Factory::getDBO();
if ($category == 1) {
$data = array();
array_unshift($data, HTMLHelper::_('select.option', 0, Text::_('JLIB_HTML_ADD_TO_ROOT'), 'value', 'text'));
} else {
//build the list of categories
$query = 'SELECT a.title AS text, a.id AS value, 0 as catid'
. ' FROM #__phocamaps_map AS a'
// TO DO. ' WHERE a.published = '.(int)$published
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$data = $db->loadObjectList();
//$tree = array();
//$text = '';
//$catId= -1;
//$tree = PhocaGalleryRenderAdmin::CategoryTreeOption($data, $tree, 0, $text, $catId);
}
// Create the batch selector to change select the category by which to move or copy.
$lines = array(
'<label id="batch-choose-action-lbl" for="batch-choose-action">',
Text::_('JLIB_HTML_BATCH_MENU_LABEL'),
'</label>',
'<fieldset id="batch-choose-action" class="combo">',
'<select name="batch[category_id]" class="form-select" id="batch-category-id">',
'<option value="">'.Text::_('JSELECT').'</option>',
/*HtmlHelper::_('select.options', HtmlHelper::_('category.options', $extension, array('published' => (int) $published))),*/
HTMLHelper::_('select.options', $data ),
'</select>',
HTMLHelper::_( 'select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'),
'</fieldset>'
);
return implode("\n", $lines);
}
}

View File

@ -0,0 +1 @@
<html><body></body></html>

View File

@ -0,0 +1,38 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
class PhocaMapsSelectMap
{
public static function options()
{
$db = Factory::getDBO();
//build the list of categories
$query = 'SELECT a.title AS text, a.id AS value'
. ' FROM #__phocamaps_map AS a'
. ' WHERE a.published = 1'
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$maps = $db->loadObjectList();
$catId = -1;
$javascript = 'class="form-control" size="1" onchange="submitform( );"';
/*$tree = array();
$text = '';
$tree = PhocaGalleryRenderAdmin::CategoryTreeOption($maps, $tree, 0, $text, $catId);
*/
return $maps;
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,154 @@
<?php
/*
* @package Joomla 3.8
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die();
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Factory;
class PhocaMapsHelper
{
public static function strTrimAll($input) {
$output = '';;
$input = trim($input);
for($i=0;$i<strlen($input);$i++) {
if(substr($input, $i, 1) != " ") {
$output .= trim(substr($input, $i, 1));
} else {
$output .= " ";
}
}
return $output;
}
public static function getPhocaVersion($component = 'com_phocamaps') {
$component = 'com_phocamaps';
$folder = JPATH_ADMINISTRATOR . '/components/'.$component;
if (Folder::exists($folder)) {
$xmlFilesInDir = Folder::files($folder, '.xml$');
} else {
$folder = JPATH_SITE . '/components/'.$component;
if (Folder::exists($folder)) {
$xmlFilesInDir = Folder::files($folder, '.xml$');
} else {
$xmlFilesInDir = null;
}
}
$xml_items = array();
if (!empty($xmlFilesInDir))
{
foreach ($xmlFilesInDir as $xmlfile)
{
if ($data = Installer::parseXMLInstallFile($folder.'/'.$xmlfile)) {
foreach($data as $key => $value) {
$xml_items[$key] = $value;
}
}
}
}
if (isset($xml_items['version']) && $xml_items['version'] != '' ) {
return $xml_items['version'];
} else {
return '';
}
}
public static function getAliasName($name) {
}
public static function fixImagePath($description) {
$description = str_replace('<img src="'.Uri::root(true).'/', '', $description);// no double
$description = str_replace('<img src="', '<img src="'.Uri::root(true).'/', $description);
// correct possible problems with full paths
$description = str_replace('<img src="'.Uri::root(true).'/http://', '<img src="http://', $description);
$description = str_replace('<img src="/http://', '<img src="http://', $description);
$description = str_replace('<img src="'.Uri::root(true).'/https://', '<img src="https://', $description);
$description = str_replace('<img src="/https://', '<img src="https://', $description);
return $description;
}
public static function filterValue($string, $type = 'html') {
switch ($type) {
case 'url':
return rawurlencode($string);
break;
case 'number':
return preg_replace( '/[^.0-9]/', '', $string );
break;
case 'number2':
//return preg_replace( '/[^0-9\.,+-]/', '', $string );
return preg_replace( '/[^0-9\.,-]/', '', $string );
break;
case 'alphanumeric':
return preg_replace("/[^a-zA-Z0-9]+/", '', $string);
break;
case 'alphanumeric2':
return preg_replace("/[^\\w-]/", '', $string);// Alphanumeric plus _ -
break;
case 'alphanumeric3':
return preg_replace("/[^\\w.-]/", '', $string);// Alphanumeric plus _ . -
break;
case 'folder':
case 'file':
$string = preg_replace('/[\"\*\/\\\:\<\>\?\'\|]+/', '', $string);
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
break;
case 'folderpath':
case 'filepath':
$string = preg_replace('/[\"\*\:\<\>\?\'\|]+/', '', $string);
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
break;
case 'text':
return htmlspecialchars(strip_tags($string), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
break;
case 'textjs':
return addslashes(strip_tags($string));
break;
case 'html':
default:
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
break;
}
}
public static function getExtInfo() {
PluginHelper::importPlugin('phocatools');
$results = Factory::getApplication()->triggerEvent('onPhocatoolsOnDisplayInfo', array('NjI5NTcyMjc3MTE3'));
if (isset($results[0]) && $results[0] === true) {
return '';
}
return '<div style="text-align: right; color: rgb(211, 211, 211); clear: both; margin-top: 10px;margin-bottom:10px;">Powered by <a href="https://www.phoca.cz" style="text-decoration: none;" target="_blank" title="Phoca.cz">Phoca</a> <a href="https://www.phoca.cz/phocamaps" style="text-decoration: none;" target="_blank" title="Phoca Maps">Maps</a></div>';
}
}
?>

View File

@ -0,0 +1,34 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Object\CMSObject;
class PhocaMapsCpHelper
{
public static function getActions()
{
$user = Factory::getUser();
$result = new CMSObject;
$assetName = 'com_phocamaps';
$actions = array(
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
);
foreach ($actions as $action) {
$result->set($action, $user->authorise($action, $assetName));
}
return $result;
}
}

View File

@ -0,0 +1,137 @@
<?php
/*
* @package Joomla 3.8
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
/* Google Maps Version 3 */
class PhocaMapsIcon
{
function __construct() {}
public static function getIconData($icon) {
// Icon Grey
$i[1]['name'] = 'igrey';
$i[1]['size'] = '20,24';
$i[1]['point1'] = '0,0';
$i[1]['point2'] = '5,30';
$i[1]['sizes'] = '32,24';
$i[1]['point1s']= '0,0';
$i[1]['point2s']= '5,30';
$i[1]['cord'] = '[14,1,16,2,18,3,19,4,19,5,19,6,19,7,18,8,18,9,17,10,16,11,16,12,15,13,14,14,14,15,15,16,17,17,17,18,18,19,17,20,14,21,10,22,7,23,2,23,2,22,2,21,2,20,1,19,1,18,1,17,1,16,1,15,0,14,0,13,0,12,0,11,0,10,0,9,7,8,7,7,8,6,8,5,9,4,9,3,10,2,11,1]';
$i[1]['type'] = 'poly';
// Icon Yellow
$i[2]['name'] = 'iyellow';
$i[2]['size'] = '26,30';
$i[2]['point1'] = '0,0';
$i[2]['point2'] = '5,30';
$i[2]['sizes'] = '41,30';
$i[2]['point1s']= '0,0';
$i[2]['point2s']= '5,30';
$i[2]['cord'] = '[18,1,19,2,21,3,23,4,24,5,24,6,24,7,24,8,23,9,23,10,22,11,22,12,21,13,20,14,20,15,19,16,19,17,18,18,17,19,18,20,20,21,22,22,22,23,22,24,22,25,18,26,15,27,12,28,8,29,4,29,4,28,3,27,3,26,3,25,3,24,3,23,2,22,2,21,2,20,2,19,2,18,1,17,1,16,1,15,1,14,1,13,1,12,1,11,9,10,10,9,10,8,11,7,11,6,12,5,12,4,13,3,14,2,14,1]';
$i[2]['type'] = 'poly';
// Icon Home
$i[3]['name'] = 'ihome';
$i[3]['size'] = '26,26';
$i[3]['point1'] = '0,0';
$i[3]['point2'] = '15,30';
$i[3]['sizes'] = '39,26';
$i[3]['point1s']= '0,0';
$i[3]['point2s']= '15,30';
$i[3]['cord'] = '[13,1,20,2,20,3,20,4,20,5,20,6,20,7,20,8,20,9,21,10,23,11,23,12,23,13,22,14,22,15,22,16,22,17,22,18,22,19,22,20,22,21,22,22,22,23,22,24,2,24,2,23,2,22,2,21,2,20,2,19,2,18,2,17,2,16,2,15,3,14,1,13,1,12,1,11,3,10,4,9,5,8,6,7,7,6,8,5,9,4,10,3,10,2,11,1]';
$i[3]['type'] = 'poly';
// Icon Home
$i[4]['name'] = 'igreen';
$i[4]['size'] = '26,26';
$i[4]['point1'] = '0,0';
$i[4]['point2'] = '15,30';
$i[4]['sizes'] = '39,26';
$i[4]['point1s']= '0,0';
$i[4]['point2s']= '15,30';
$i[4]['cord'] = '[15,2,18,3,19,4,20,5,21,6,22,7,23,8,23,9,23,10,23,11,23,12,23,13,23,14,23,15,23,16,22,17,22,18,21,19,20,20,19,21,17,22,21,23,21,24,16,25,8,25,4,24,4,23,8,22,6,21,5,20,4,19,3,18,3,17,2,16,2,15,2,14,2,13,2,12,2,11,2,10,2,9,2,8,3,7,4,6,5,5,6,4,7,3,10,2]';
$i[4]['type'] = 'poly';
// Icon Star
$i[5]['name'] = 'istar';
$i[5]['size'] = '26,26';
$i[5]['point1'] = '0,0';
$i[5]['point2'] = '15,30';
$i[5]['sizes'] = '39,26';
$i[5]['point1s']= '0,0';
$i[5]['point2s']= '15,30';
$i[5]['cord'] = '[13,0,13,1,13,2,14,3,14,4,15,5,15,6,15,7,21,8,25,9,25,10,23,11,22,12,21,13,20,14,19,15,19,16,19,17,19,18,19,19,19,20,20,21,20,22,20,23,20,24,19,25,6,25,5,24,5,23,5,22,5,21,5,20,5,19,6,18,6,17,6,16,6,15,5,14,4,13,3,12,2,11,0,10,0,9,4,8,9,7,9,6,10,5,10,4,11,3,11,2,12,1,12,0]';
$i[5]['type'] = 'poly';
// Icon Info Home
$i[6]['name'] = 'iinfoh';
$i[6]['size'] = '25,33';
$i[6]['point1'] = '0,0';
$i[6]['point2'] = '11,33';
$i[6]['sizes'] = '42,33';
$i[6]['point1s']= '0,0';
$i[6]['point2s']= '11,33';
$i[6]['cord'] = '[22,0,23,1,24,2,24,3,24,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,23,22,22,23,20,24,19,25,18,26,18,27,17,28,16,29,16,30,15,31,15,32,9,32,9,31,8,30,8,29,7,28,6,27,6,26,5,25,4,24,2,23,1,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,1,1,2,0]';
$i[6]['type'] = 'poly';
// Icon Info Info
$i[7]['name'] = 'iinfoi';
$i[7]['size'] = '25,33';
$i[7]['point1'] = '0,0';
$i[7]['point2'] = '11,33';
$i[7]['sizes'] = '42,33';
$i[7]['point1s']= '0,0';
$i[7]['point2s']= '11,33';
$i[7]['cord'] = '[22,0,23,1,24,2,24,3,24,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,23,22,22,23,20,24,19,25,18,26,18,27,17,28,16,29,16,30,15,31,15,32,9,32,9,31,8,30,8,29,7,28,6,27,6,26,5,25,4,24,2,23,1,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,1,1,2,0]';
$i[7]['type'] = 'poly';
// Icon Info Post
$i[8]['name'] = 'iinfop';
$i[8]['size'] = '25,33';
$i[8]['point1'] = '0,0';
$i[8]['point2'] = '11,33';
$i[8]['sizes'] = '42,33';
$i[8]['point1s']= '0,0';
$i[8]['point2s']= '11,33';
$i[8]['cord'] = '[22,0,23,1,24,2,24,3,24,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,23,22,22,23,20,24,19,25,18,26,18,27,17,28,16,29,16,30,15,31,15,32,9,32,9,31,8,30,8,29,7,28,6,27,6,26,5,25,4,24,2,23,1,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,1,1,2,0]';
$i[8]['type'] = 'poly';
// Icon Info Phone
$i[9]['name'] = 'iinfoph';
$i[9]['size'] = '25,33';
$i[9]['point1'] = '0,0';
$i[9]['point2'] = '11,33';
$i[9]['sizes'] = '42,33';
$i[9]['point1s']= '0,0';
$i[9]['point2s']= '11,33';
$i[9]['cord'] = '[22,0,23,1,24,2,24,3,24,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,23,22,22,23,20,24,19,25,18,26,18,27,17,28,16,29,16,30,15,31,15,32,9,32,9,31,8,30,8,29,7,28,6,27,6,26,5,25,4,24,2,23,1,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,1,1,2,0]';
$i[9]['type'] = 'poly';
// Icon Info Zoom
$i[10]['name'] = 'iinfoz';
$i[10]['size'] = '25,33';
$i[10]['point1'] = '0,0';
$i[10]['point2'] = '11,33';
$i[10]['sizes'] = '42,33';
$i[10]['point1s']= '0,0';
$i[10]['point2s']= '11,33';
$i[10]['cord'] = '[22,0,23,1,24,2,24,3,24,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,23,22,22,23,20,24,19,25,18,26,18,27,17,28,16,29,16,30,15,31,15,32,9,32,9,31,8,30,8,29,7,28,6,27,6,26,5,25,4,24,2,23,1,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,1,1,2,0]';
$i[10]['type'] = 'poly';
if(isset($i[$icon])) {
return $i[$icon];
} else {
return false;
}
}
}
?>

View File

@ -0,0 +1,31 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Object\CMSObject;
class PhocaMapsIconsHelper
{
public static function getActions($t, $id = 0) {
$user = Factory::getUser();
$result = new CMSObject;
if (empty($id)) {
$assetName = $t['o'];
} else {
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
}
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
foreach ($actions as $action) {
$result->set($action, $user->authorise($action, $assetName));
}
return $result;
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,761 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\Form;
class PhocaMapsMapOsm
{
protected $name = 'phocaMap';
protected $id = '';
private $output = array();
public $router = '';
public $maprouterapikey = '';
public $routerserviceurl = '';
public $routerprofile = '';
public $thunderforestmaptype = '';
public $osmmaptype = '';
public $osmmaproutertype = '';
public $currentposition = '';
public $fullscreen = '';
public $search = '';
public $zoomwheel = '';
public $zoomcontrol = '';
public $easyprint = '';
public $markerclustering = 0;
/*var $_map = 'mapPhocaMap';
var $_latlng = 'phocaLatLng';
var $_options = 'phocaOptions';
var $_tst = 'tstPhocaMap';
var $_tstint = 'tstIntPhocaMap';
var $_marker = FALSE;
var $_window = FALSE;
var $_dirdisplay = FALSE;
var $_dirservice = FALSE;
var $_geocoder = FALSE;
var $_iconArray = array();*/
function __construct($id = '') {
$app = Factory::getApplication();
$paramsC = ComponentHelper::getParams('com_phocamaps');
$this->router = $paramsC->get( 'osm_router', 0 );
$this->maprouterapikey = $paramsC->get( 'osm_map_router_api_key', '' );
$this->routerserviceurl = $paramsC->get( 'osm_router_routerserviceurl', '' );
$this->routerprofile = $paramsC->get( 'osm_router_profile', '' );
$this->thunderforestmaptype = $paramsC->get( 'thunderforest_map_type', '' );
$this->osmmaptype = $paramsC->get( 'osm_map_type', '' );
$this->osmmaproutertype = $paramsC->get( 'osm_map_router_type', '' );
$this->currentposition = $paramsC->get( 'osm_current_position', 1 );
$this->fullscreen = $paramsC->get( 'osm_full_screen',1 );
$this->search = $paramsC->get( 'osm_search', 0 );
$this->zoomwheel = $paramsC->get( 'osm_zoom_wheel', 1);
$this->zoomcontrol = $paramsC->get( 'osm_zoom_control', 1 );
$this->easyprint = $paramsC->get( 'osm_easyprint', 0 );
$this->markerclustering = $paramsC->get( 'marker_clustering', 0 );
$this->id = $id;
if ($app->isClient('administrator')) {
$this->fullscreen = 1;
$this->search = 1;
$this->zoomwheel = 1;
$this->zoomcontrol = 1;
$this->currentposition = 1;
}
}
function loadAPI() {
$document = Factory::getDocument();
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet/leaflet.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet/leaflet.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-awesome/leaflet.awesome-markers.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-awesome/leaflet.awesome-markers.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-fullscreen/Leaflet.fullscreen.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-fullscreen/leaflet.fullscreen.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-control-locate/L.Control.Locate.min.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-control-locate/L.Control.Locate.css');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-control-locate/font-awesome.min.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-omnivore/leaflet-omnivore.js');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-search/leaflet-search.min.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-search/leaflet-search.css');
if ($this->router == 1) {
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-routing-machine/leaflet-routing-machine.min.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-routing-machine/leaflet-routing-machine.css');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-geocoder/Control.Geocoder.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-geocoder/Control.Geocoder.js');
}
if ($this->easyprint == 1) {
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-easyprint/bundle.js');
}
if ($this->markerclustering == 1) {
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-markercluster/MarkerCluster.css');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-markercluster/MarkerCluster.Default.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-markercluster/leaflet.markercluster.min.js');
}
}
function loadCoordinatesJS() {
$document = Factory::getDocument();
$document->addScript(Uri::root(true).'/media/com_phocamaps/js/administrator/coordinates.js');
}
function createMap($lat, $lng, $zoom) {
$app = Factory::getApplication();
$opt = array();
if ($this->zoomwheel == 0) {
$opt[] = 'scrollWheelZoom: false,';
}
if ($this->zoomcontrol == 0) {
$opt[] = 'zoomControl: false,';
}
//if ($this->zoomcontrol == 0) {
$opt[] = 'zoomControl: false,';
//}
$options = '{' . implode("\n", $opt) . '}';
$o = array();
$o[]= 'var map'.$this->name.$this->id.' = L.map("'.$this->name.$this->id.'", '.$options.').setView(['.PhocaMapsHelper::filterValue($lat, 'number2').', '.PhocaMapsHelper::filterValue($lng, 'number2').'], '.(int)$zoom.');';
if ($this->zoomcontrol == 1) {
$o[] = 'new L.Control.Zoom({ zoomInTitle: \''.Text::_('COM_PHOCACART_ZOOM_IN_TITLE').'\', zoomOutTitle: \''.Text::_('COM_PHOCACART_ZOOM_OUT_TITLE').'\' }).addTo(map'.$this->name.$this->id.');';
}
if ($this->markerclustering == 1) {
$o[] = 'var markers' . $this->name . $this->id . ' = L.markerClusterGroup();';
}
$this->output[] = implode("\n", $o);
return true;
}
function setMapType() {
$app = Factory::getApplication();
// Possible new parameters
$thunderForestMapType = $this->thunderforestmaptype;
$thunderForestKey = $this->maprouterapikey;
$mapBoxKey = $this->maprouterapikey;
$type = $this->osmmaptype;
$o = array();
if ($type === "osm_de") {
$o[] = 'L.tileLayer(\'https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 18,';
$o[] = ' attribution: \'&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type === "osm_bw") {
//$o[] = 'L.tileLayer(\'http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png\', {';
$o[] = 'L.tileLayer(\'https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 18,';
$o[] = ' attribution: \'&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type === 'thunderforest') {
if ($thunderForestKey == '') {
$app->enqueueMessage(Text::_('COM_PHOCAMAPS_ERROR_API_KEY_NOT_SET'));
return false;
}
if ($thunderForestMapType == '') {
$app->enqueueMessage(Text::_('COM_PHOCAMAPS_ERROR_MAP_TYPE_NOT_SET'));
return false;
}
$o[] = 'L.tileLayer(\'https://{s}.tile.thunderforest.com/'.PhocaMapsHelper::filterValue($thunderForestMapType).'/{z}/{x}/{y}.png?apikey={apikey}\', {';
$o[] = ' maxZoom: 22,';
$o[] = ' apikey: \''.PhocaMapsHelper::filterValue($thunderForestKey).'\',';
$o[] = ' attribution: \'&copy; <a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>, &copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type === 'mapbox') {
if ($mapBoxKey == '') {
$app->enqueueMessage(Text::_('COM_PHOCAMAPS_ERROR_API_KEY_NOT_SET'));
return false;
}
$o[] = 'L.tileLayer(\'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token='.PhocaMapsHelper::filterValue($mapBoxKey).'\', {';
$o[] = ' maxZoom: 18,';
$o[] = ' attribution: \'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors, \' + ';
$o[] = ' \'<a href="https://creativecommons.org/licenses/by-sa/2.0/" target="_blank" target="_blank">CC-BY-SA</a>, \' + ';
$o[] = ' \'Imagery © <a href="https://mapbox.com" target="_blank">Mapbox</a>\',';
$o[] = ' id: \'mapbox.streets\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type === 'opentopomap') {
$o[] = 'L.tileLayer(\'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 17,';
$o[] = ' attribution: \'Map data: &copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, <a href="https://viewfinderpanoramas.org" target="_blank">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>)\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type === 'google') {
/*
$o[] = 'L.gridLayer.googleMutant({';
$o[] = ' type: googlemapstype,';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
*/
} else if ($type === 'wikimedia') {
$o[] = 'L.tileLayer(\'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 18,';
$o[] = ' attribution: \'&copy; <a href="https://wikimediafoundation.org/wiki/Maps_Terms_of_Use" target="_blank">Wikimedia maps</a> | Map data © <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type == 'osm_fr') {
$o[] = 'L.tileLayer(\'https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 20,';
$o[] = ' attribution: \'&copy; <a href="https://www.openstreetmap.fr" target="_blank">Openstreetmap France</a> & <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type == 'osm_hot') {
$o[] = 'L.tileLayer(\'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 20,';
$o[] = ' attribution: \'&copy; <a href="https://hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> & <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else {
$o[] = 'L.tileLayer(\'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 18,';
$o[] = ' attribution: \'&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
}
$this->output[] = implode("\n", $o);
return true;
}
public function setMarker($markerId, $title, $description, $lat, $lng, $text = '', $width = '', $height = '', $open = 0, $closeOpenedWindow = 0) {
$o = array();
if($open != 2){
$o[]= 'var marker'.$markerId.' = L.marker(['.PhocaMapsHelper::filterValue($lat, 'number2').', '.PhocaMapsHelper::filterValue($lng, 'number2').'])';
if ($this->markerclustering == 1) {
// marker will be added to layer with cluster function
} else {
$o[] = '.addTo(map'.$this->name.$this->id.');';
}
$o[] = ';';
}
jimport('joomla.filter.output');
$style = '';
if ($width != '') {
$style .= 'width: '.(int)$width.'px;';
}
if ($height != '') {
$style .= 'height: '.(int)$height.'px;';
}
if ($text == '') {
if ($title != ''){
$hStyle = 'font-size:120%;margin: 5px 0px;font-weight:bold;';
$text .= '<div style="'.$hStyle.'">' . addslashes($title) . '</div>';
}
if ($description != '') {
$text .= '<div>'.PhocaMapsHelper::strTrimAll(addslashes($description)).'</div>';
}
}
if ($text != '') {
if ($style != '') {
$text = '<div style="'.$style.'">' . $text . '</div>';
}
$openO = '';
if ($open == 1) {
$openO = '.openPopup()';
}
$o[]= 'marker'.$markerId.'.bindPopup(\''.$text.'\')'.$openO.';';
}
if ($this->markerclustering == 1) {
$o[] = 'markers' . $this->name . $this->id . '.addLayer(marker' . $markerId . ');';
}
$this->output[] = implode("\n", $o);
return true;
}
public function setMarkerClusterer() {
if ($this->markerclustering == 1) {
$o = array();
$o[] = 'map' . $this->name . $this->id . '.addLayer(markers' . $this->name . $this->id . ');';
$this->output[] = implode("\n", $o);
}
}
public function setMarkerIcon($markerId, $icon = 'circle', $markerColor = 'blue', $iconColor = '#ffffff', $prefix = 'fa', $spin = 'false', $extraClasses = '' ) {
$o = $o2 = array();
$o[]= 'var icon'.$markerId.' = new L.AwesomeMarkers.icon({';
$o[]= $o2[] = ' icon: "'.PhocaMapsHelper::filterValue($icon).'",';
$o[]= $o2[] = ' markerColor: "'.PhocaMapsHelper::filterValue($markerColor).'",';
$o[]= $o2[] = ' iconColor: "'.PhocaMapsHelper::filterValue($iconColor).'",';
$o[]= $o2[] = ' prefix: "'.PhocaMapsHelper::filterValue($prefix).'",';
$o[]= $o2[] = ' spin: '.PhocaMapsHelper::filterValue($spin).',';
$o[]= $o2[] = ' extraClasses: "'.PhocaMapsHelper::filterValue($extraClasses).'",';
$o[]= '})';
$o[]= ' marker'.$markerId.'.setIcon(icon'.$markerId.');';
$this->output[] = implode("\n", $o);
return $o2;//return only options;
}
public function inputMarker($latInput, $longInput, $zoomInput = '', $setGPS = 0) {
$o = array();
$o[]= 'function phmInputMarker(lat, lng) {';
$o[]= 'var phLat = jQuery(\'#jform_latitude_id\', window.parent.document);';
$o[]= 'var phLng = jQuery(\'#jform_longitude_id\', window.parent.document);';
$o[]= 'phLat.val(lat);';
$o[]= 'phLng.val(lng);';
if ( $zoomInput != '') {
$o[]= 'var phZoom = jQuery(\'#jform_zoom_id\', window.parent.document);';
$o[]= 'phZoom.val(map'.$this->name.$this->id.'.getZoom());';
$o[]= 'var phmMsg = \'<span class="ph-msg-success">'.Text::_('COM_PHOCAMAPS_LAT_LNG_ZOOM_SET').'</span>\';';
} else {
$o[]= 'var phmMsg = \'<span class="ph-msg-success">'.Text::_('COM_PHOCAMAPS_LAT_LNG_SET').'</span>\';';
}
$o[]= 'jQuery(\'#phmPopupInfo\', window.parent.document).html(phmMsg);';
if ($setGPS == 1) {
$o[]= ' if (window.parent) {setPMGPSLatitudeJForm(lat);}';
$o[]= ' if (window.parent) {setPMGPSLongitudeJForm(lng);}';
}
$o[]= '}';
$this->output[] = implode("\n", $o);
return true;
}
public function moveMarker() {
$o = array();
$o[]= 'function phmMoveMarker(marker, lat, lng) {';
$o[]= ' var newLatLng = new L.LatLng(lat, lng);';
$o[]= ' marker.setLatLng(newLatLng);';
$o[]= '}';
$this->output[] = implode("\n", $o);
return true;
}
public function exportMarker($markerId) {
$o = array();
$o[] = 'map'.$this->name.$this->id.'.on(\'click\', onMapClick);';
$o[] = 'function onMapClick(e) {';
$o[] = ' phmInputMarker(e.latlng.lat, e.latlng.lng);';
$o[] = ' phmMoveMarker(marker'.$markerId.', e.latlng.lat, e.latlng.lng);';
$o[] = '}';
$this->output[] = implode("\n", $o);
return true;
}
public function renderSearch($markerId = '', $position = '') {
if ($this->search == 0) {
return '';
}
$position = $position != '' ? $position : 'topright';
$o = array();
$o[] = 'map'.$this->name.$this->id.'.addControl(new L.Control.Search({';
$o[] = ' url: \'https://nominatim.openstreetmap.org/search?format=json&q={s}\',';
$o[] = ' jsonpParam: \'json_callback\',';
$o[] = ' propertyName: \'display_name\',';
$o[] = ' propertyLoc: [\'lat\',\'lon\'],';
$o[] = ' marker: L.circleMarker([0,0],{radius:30}),';
$o[] = ' autoCollapse: true,';
$o[] = ' autoType: false,';
$o[] = ' minLength: 3,';
$o[] = ' position: \''.$position.'\',';
$o[] = ' textErr: \''.Text::_('COM_PHOCAMAPS_SEARCH_LOCATION_NOT_FOUND').'\',';
$o[] = ' textCancel: \''.Text::_('COM_PHOCAMAPS_SEARCH_CANCEL').'\',';
$o[] = ' textPlaceholder: \''.Text::_('COM_PHOCAMAPS_SEARCH_SEARCH').'\',';
if ($markerId != '') {
$o[] = ' moveToLocation: function(latlng, title, map) {';
$o[] = ' map'.$this->name.$this->id.'.setView(latlng, 7);';// set the zoom first so it will be added to form input
$o[] = ' phmInputMarker(latlng.lat, latlng.lng);';
$o[] = ' phmMoveMarker(marker'.$markerId.', latlng.lat, latlng.lng);';
$o[] = ' }';
}
$o[] = '}));';
$this->output[] = implode("\n", $o);
return true;
}
public function renderFullScreenControl() {
if ($this->fullscreen == 0) {
return false;
}
$o = array();
$o[] = 'map'.$this->name.$this->id.'.addControl(';
$o[] = ' new L.Control.Fullscreen({';
$o[] = ' position: \'topright\',';
$o[] = ' title: {';
$o[] = ' \'false\': \''.Text::_('COM_PHOCAMAPS_VIEW_FULLSCREEN').'\',';
$o[] = ' \'true\': \''.Text::_('COM_PHOCAMAPS_EXIT_FULLSCREEN').'\'';
$o[] = ' }';
$o[] = ' })';
$o[] = ')';
$this->output[] = implode("\n", $o);
return true;
}
public function renderCurrentPosition($markerId = '') {
if ($this->currentposition == 0) {
return false;
}
$o = array();
$o[] = 'L.control.locate({';
$o[] = ' position: \'topright\',';
$o[] = ' strings: {';
$o[] = ' \'title\': \''.Text::_('COM_PHOCAMAPS_CURRENT_POSITION').'\'';
$o[] = ' },';
$o[] = ' locateOptions: {';
$o[] = ' enableHighAccuracy: true,';
$o[] = ' watch: true,';
$o[] = ' },';
/*if ($markerId != '') {
$o[] = ' onlocationfound: function(latlng, title, map) {';
$o[] = ' map'.$this->name.$this->id.'.setView(latlng, 7);';// set the zoom first so it will be added to form input
$o[] = ' phmInputMarker(latlng.lat, latlng.lng);';
$o[] = ' phmMoveMarker(marker'.$markerId.', latlng.lat, latlng.lng);';
$o[] = ' }';
}*/
$o[] = '}).addTo(map'.$this->name.$this->id.');';
if ($markerId != '') {
$o[] = ' map' . $this->name . $this->id . '.on("locationfound", function(e) {';
//$o[] = ' map'.$this->name.$this->id.'.setView(e.latlng, 7);';// set the zoom first so it will be added to form input
$o[] = ' phmInputMarker(e.latitude, e.longitude);';
$o[] = ' phmMoveMarker(marker' . $markerId . ', e.latitude, e.longitude);';
$o[] = ' });';
}
$this->output[] = implode("\n", $o);
return true;
}
public function renderEasyPrint() {
if ($this->easyprint == 0) {
return false;
}
$o = array();
$o[] = 'map'.$this->name.$this->id.'.addControl(';
$o[] = ' new L.easyPrint({';
$o[] = ' hideControlContainer: true,';
$o[] = ' sizeModes: [\'Current\', \'A4Portrait\', \'A4Landscape\'],';
$o[] = ' position: \'topleft\',';
$o[] = ' exportOnly: true';
$o[] = ' })';
$o[] = ');';
$this->output[] = implode("\n", $o);
return true;
}
public function renderRouting($latFrom = 0, $lngFrom = 0, $latTo = 0, $lngTo = 0, $markerId = '', $markerIconOptions = array(), $language = '') {
if ($this->router == 0) {
return false;
}
$o = array();
if ($this->routerserviceurl == '' && $this->maprouterapikey == '') {
$o[] = 'console.log(\'Routing Error: No router or service url set\')';
$this->output[] = implode("\n", $o);
return true;
}
$o[] = 'var routingControl = L.Routing.control({';
$o[] = ' waypoints: [';
if ($latFrom == 0 && $lngFrom == 0 && $latTo != 0 && $lngTo != 0) {
$o[] = ' L.latLng(\'\'),';
} else if ($latFrom == 0 && $lngFrom == 0) {
$o[] = ' L.latLng(\'\'),';
} else {
$o[] = ' L.latLng('.PhocaMapsHelper::filterValue($latFrom, 'number2').', '.PhocaMapsHelper::filterValue($lngFrom, 'number2').'),';
}
if ($latTo == 0 && $lngTo == 0) {
$o[] = ' L.latLng(\'\'),';
} else {
$o[] = ' L.latLng('.PhocaMapsHelper::filterValue($latTo, 'number2').', '.PhocaMapsHelper::filterValue($lngTo, 'number2').')';
}
$o[] = ' ],';
if ($language != '') {
$o[] = ' language: \''.PhocaMapsHelper::filterValue($language, 'text').'\',';
}
if ($markerId != '') {
//$o[] = ' marker: marker'.$markerId.',';
// Don't create new marker for routing (so if we have "TO" address with marker created in map
// don't display any marker
//if (!empty($markerIconOptions)) {
if ($latTo != 0 && $lngTo != 0) {
$o[] = ' createMarker: function(i,wp, n) {';
$o[] = ' var latToMarker = '.PhocaMapsHelper::filterValue($latTo, 'number2').';';
$o[] = ' var lngToMarker = '.PhocaMapsHelper::filterValue($lngTo, 'number2').';';
$o[] = ' if (wp.latLng.lat == latToMarker && wp.latLng.lng == lngToMarker) {';
$o[] = ' return false;';
$o[] = ' } else {';
// Get the same icon as the "To" (End) has
if (!empty($markerIconOptions)) {
$o[] = ' var ma = L.marker(wp.latLng);';
$o[] = ' var ic = new L.AwesomeMarkers.icon({';
foreach($markerIconOptions as $k => $v) {
// Change the icon to circle (e.g. the "To" (End) is set to home, so don't render the same icon for "From" (start) address
if (strpos($v, 'icon:') !== false) {
$v = 'icon: "circle",';
}
$o[] = ' '.$v. "\n";
}
$o[] = ' });';
$o[] = ' ma.setIcon(ic);';
$o[] = ' return ma;';
} else {
$o[] = ' return L.marker(wp.latLng);';
}
$o[] = ' }';
$o[] = ' },';
}
}
$o[] = ' routeWhileDragging: true,';
$o[] = ' geocoder: L.Control.Geocoder.nominatim(),';
$o[] = ' reverseWaypoints: true,';
$o[] = ' showAlternatives: true,';
$o[] = ' collapsible: true,';
$o[] = ' show: false,';
/*
if ($this->routerserviceurl == 'https://api.mapbox.com/directions/v5') {
// DEBUG DEMO - default address of leaflet-routing-machine to debug
} else if ($this->routerserviceurl != '') {
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
} else if ($this->osm_map_type == 'mapbox' && $this->maprouterapikey != '') {
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\'),';
} else {
$o[] = array();
$o[] = 'console.log(\'Routing Error: No router or service url set\')';
$this->output[] = implode("\n", $o);
return true;
}*/
if ($this->routerserviceurl == 'https://api.mapbox.com/directions/v5') {
// DEBUG DEMO - default address of leaflet-routing-machine to debug
} else if ($this->routerserviceurl != '' && $this->maprouterapikey != '' && $this->osmmaproutertype == 'mapbox'){
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\',{language: \''.PhocaMapsHelper::filterValue($language, 'text').'\'}),';
} else if ($this->routerserviceurl != '') {
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
}
/* else if ($this->osm_map_type == 'mapbox' && $this->maprouterapikey != '') {
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\'),';
}*/
else {
$o[] = array();
$o[] = 'console.log(\'Routing Error: No router or service url set\')';
$this->output[] = implode("\n", $o);
return true;
}
/*
if ($this->routerserviceurl == 'https://api.mapbox.com/directions/v5') {
// DEBUG DEMO - default address of leaflet-routing-machine to debug
} else if ($this->osm_map_type == 'mapbox' && $this->maprouterapikey != '' && $this->routerserviceurl != '') {
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
//$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\'),';
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\',{language: \''.PhocaMapsHelper::filterValue($language, 'text').'\'}),';
} else if ($this->osm_map_type == 'mapbox' && $this->maprouterapikey != '') {
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\'),';
} else if ($this->routerserviceurl != '') {
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
} else {
$o[] = array();
$o[] = 'console.log(\'Routing Error: No router or service url set\')';
$this->output[] = implode("\n", $o);
return true;
}
*/
if ($this->routerprofile != '') {
$o[] = ' profile: \''.PhocaMapsHelper::filterValue($this->routerprofile).'\',';
}
$o[] = '})';
// $o[] = '.on(\'routingstart\', showSpinner)';
//$o[] = '.on(\'routesfound routingerror\', hideSpinner)';
$o[] = '.addTo(map'.$this->name.$this->id.');';
//$o[] = 'routingControl.hide();';
$this->output[] = implode("\n", $o);
return true;
}
/**
* @param unknown $filename - url of gpx/kml file to load
* @param string $color - optional hex colour value for track (default to blue)
* @param boolean $fitbounds - if true adjust the map centre and zoom to fit the track
* @return boolean
* @desc renderTrack() adds a gpx or kml filename layer
* @author RogerCO added 22/6/2021 for v3.0.12
*/
public function renderTrack($filename, $color = '', $fitbounds = false) {
$ext = parse_url($filename)['path'];
//check we have a gpx or kml file (mime type not defined for these so use extension)
$ext = substr($ext,strrpos($ext,'.'));
if (($ext != '.gpx') && ($ext != '.kml')) {
return false;
}
$mapname = 'map'.$this->name.$this->id;
// colour layer doesn't seem to work for kml files
if (($ext=='.gpx') && $color) {
$this->output[] = " var customLayer = L.geoJson(null, { style: function(feature) {return {color: '".$color."'}; } });";
} else {
$this->output[] = "var customLayer = null;";
}
if ($fitbounds) {
$this->output[] = "var runLayer = omnivore".$ext."('".$filename."', null, customLayer).on('ready', function() {
".$mapname.".fitBounds(runLayer.getBounds());
}).addTo(".$mapname.")";
} else {
$this->output[] = "omnivore".$ext."('".$filename."', null, customLayer).addTo(".$mapname.")";
}
return true;
}
public function renderMap() {
$o = array();
$o[] = 'jQuery(document).ready(function() {';
$o[] = implode("\n", $this->output);
$o[] = '})';
Factory::getDocument()->addScriptDeclaration(implode("\n", $o));
}
}
?>

View File

@ -0,0 +1,31 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Object\CMSObject;
class PhocaMapsMapsHelper
{
public static function getActions($t, $id = 0) {
$user = Factory::getUser();
$result = new CMSObject;
if (empty($id)) {
$assetName = $t['o'];
} else {
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
}
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
foreach ($actions as $action) {
$result->set($action, $user->authorise($action, $assetName));
}
return $result;
}
}
?>

View File

@ -0,0 +1,31 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Object\CMSObject;
class PhocaMapsMarkersHelper
{
public static function getActions($t, $id = 0) {
$user = Factory::getUser();
$result = new CMSObject;
if (empty($id)) {
$assetName = $t['o'];
} else {
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
}
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
foreach ($actions as $action) {
$result->set($action, $user->authorise($action, $assetName));
}
return $result;
}
}
?>

View File

@ -0,0 +1,36 @@
<?php
/*
* @package Joomla 3.8
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Gallery
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Uri\Uri;
class PhocaMapsPath extends CMSObject
{
function __construct() {}
public static function getInstance() {
static $instance;
if (!$instance) {
$instance = new PhocaMapsPath();
$instance->kml_abs = JPATH_ROOT . '/phocamapskml/';
$instance->kml_rel = Uri::base(true) . '/phocamapskml/';
$instance->kml_rel_full = Uri::base() . 'phocamapskml/';
}
return $instance;
}
public static function getPath() {
$instance = PhocaMapsPath::getInstance();
return $instance;
}
}
?>

View File

@ -0,0 +1,107 @@
<?php
/*
* @package Joomla 3.8
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die();
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
class PhocaMapsRenderAdmin
{
public static function quickIconButton( $link, $image, $text, $imgUrl ) {
return '<div class="thumbnails ph-icon">'
.'<a class="thumbnail ph-icon-inside" href="'.$link.'">'
.HTMLHelper::_('image', $imgUrl . $image, $text )
.'<br /><span>'.$text.'</span></a></div>'. "\n";
}
public static function getLinks() {
$app = Factory::getApplication();
$option = $app->input->get('option');
$oT = strtoupper($option);
$links = array();
switch ($option) {
case 'com_phocamaps':
$links[] = array('Phoca Maps site', 'https://www.phoca.cz/phocamaps');
$links[] = array('Phoca Maps documentation site', 'https://www.phoca.cz/documentation/category/53-phoca-maps-component');
$links[] = array('Phoca Maps download site', 'https://www.phoca.cz/download/category/81-phoca-maps');
break;
}
$links[] = array('Phoca News', 'https://www.phoca.cz/news');
$links[] = array('Phoca Forum', 'https://www.phoca.cz/forum');
$components = array();
$components[] = array('Phoca Gallery','phocagallery', 'pg');
$components[] = array('Phoca Guestbook','phocaguestbook', 'pgb');
$components[] = array('Phoca Download','phocadownload', 'pd');
$components[] = array('Phoca Documentation','phocadocumentation', 'pdc');
$components[] = array('Phoca Favicon','phocafavicon', 'pfv');
$components[] = array('Phoca SEF','phocasef', 'psef');
$components[] = array('Phoca PDF','phocapdf', 'ppdf');
$components[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
$components[] = array('Phoca Maps','phocamaps', 'pm');
$components[] = array('Phoca Font','phocafont', 'pf');
$components[] = array('Phoca Email','phocaemail', 'pe');
$components[] = array('Phoca Install','phocainstall', 'pi');
$components[] = array('Phoca Template','phocatemplate', 'pt');
$components[] = array('Phoca Panorama','phocapanorama', 'pp');
$components[] = array('Phoca Commander','phocacommander', 'pcm');
$components[] = array('Phoca Photo','phocaphoto', 'pcm');
$banners = array();
$banners[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
$banners[] = array('Phoca Cart','phocacart', 'pc');
$o = '';
$o .= '<p>&nbsp;</p>';
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($oT.'_USEFUL_LINKS'). '</h4>';
$o .= '<ul>';
foreach ($links as $k => $v) {
$o .= '<li><a style="text-decoration:underline" href="'.$v[1].'" target="_blank">'.$v[0].'</a></li>';
}
$o .= '</ul>';
$o .= '<div>';
$o .= '<p>&nbsp;</p>';
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($oT.'_USEFUL_TIPS'). '</h4>';
$m = mt_rand(0, 10);
if ((int)$m > 3) {
$o .= '<div>';
$num = range(0,(count($components) - 1 ));
shuffle($num);
for ($i = 0; $i<3; $i++) {
$numO = $num[$i];
$o .= '<div style="float:left;width:33%;margin:0 auto;">';
$o .= '<div><a style="text-decoration:underline;" href="https://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'.HtmlHelper::_('image', 'media/'.$option.'/images/administrator/icon-box-'.$components[$numO][2].'.png', ''). '</a></div>';
$o .= '<div style="margin-top:-10px;"><small><a style="text-decoration:underline;" href="https://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'.$components[$numO][0].'</a></small></div>';
$o .= '</div>';
}
$o .= '<div style="clear:both"></div>';
$o .= '</div>';
} else {
$num = range(0,(count($banners) - 1 ));
shuffle($num);
$numO = $num[0];
$o .= '<div><a href="https://www.phoca.cz/'.$banners[$numO][1].'" target="_blank">'.HTMLHelper::_('image', 'media/'.$option.'/images/administrator/b-'.$banners[$numO][2].'.png', ''). '</a></div>';
}
$o .= '<p>&nbsp;</p>';
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($oT.'_PLEASE_READ'). '</h4>';
$o .= '<div><a style="text-decoration:underline" href="https://www.phoca.cz/phoca-needs-your-help/" target="_blank">'.Text::_($oT.'_PHOCA_NEEDS_YOUR_HELP'). '</a></div>';
$o .= '</div>';
return $o;
}
}

View File

@ -0,0 +1,31 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Factory;
class PhocaMapsUtils
{
public static function setVars( $task = '') {
$a = array();
$app = Factory::getApplication();
$a['o'] = htmlspecialchars(strip_tags($app->input->get('option')));
$a['c'] = str_replace('com_', '', $a['o']);
$a['n'] = 'Phoca' . ucfirst(str_replace('com_phoca', '', $a['o']));
$a['l'] = strtoupper($a['o']);
$a['i'] = 'media/'.$a['o'].'/images/administrator/';
$a['ja'] = 'media/'.$a['o'].'/js/administrator/';
$a['jf'] = 'media/'.$a['o'].'/js/';
$a['s'] = 'media/'.$a['o'].'/css/administrator/'.$a['c'].'.css';
$a['css'] = 'media/'.$a['o'].'/css/';
$a['task'] = $a['c'] . htmlspecialchars(strip_tags($task));
$a['tasks'] = $a['task']. 's';
return $a;
}
}
?>

View File

@ -0,0 +1,37 @@
<?php
/**
* @package Phoca Gallery
* @author Jan Pavelka - https://www.phoca.cz
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
* @cms Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Session\Session;
use Phoca\Render\Adminview;
use Joomla\CMS\Factory;
use Joomla\CMS\Version;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
class PhocaMapsRenderAdminView extends AdminView
{
public $view = '';
public $viewtype = 2;
public $option = '';
public $optionLang = '';
public $compatible = false;
public $sidebar = true;
protected $document = false;
public function __construct(){
parent::__construct();
}
}
?>

View File

@ -0,0 +1,47 @@
<?php
/**
* @package Phoca Download
* @author Jan Pavelka - https://www.phoca.cz
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
* @cms Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Version;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Uri\Uri;
// Frontend editor - button plugin
require_once JPATH_ADMINISTRATOR . '/components/com_phocamaps/libraries/autoloadPhoca.php';
use Phoca\Render\Adminviews;
class PhocaMapsRenderAdminViews extends AdminViews
{
public $view = '';
public $viewtype = 1;
public $option = '';
public $optionLang = '';
public $tmpl = '';
public $compatible = false;
public $sidebar = true;
protected $document = false;
public function __construct() {
parent::__construct();
}
}
?>

View File

@ -0,0 +1,33 @@
<?php
/**
* @package Phoca Maps
* @author Jan Pavelka - https://www.phoca.cz
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
* @cms Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die();
use Joomla\CMS\Component\Router\Rules\MenuRules;
use Joomla\Registry\Registry;
class PhocaMapsRouterrules extends MenuRules
{
public function preprocess(&$query)
{
parent::preprocess($query);
}
protected function buildLookup($language = '*')
{
parent::buildLookup($language);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1 @@
<html><body style="background-color: #000;"></body></html>

View File

@ -0,0 +1 @@
<html><body style="background-color: #000;"></body></html>

View File

@ -0,0 +1 @@
<html><body style="background-color: #000;"></body></html>

View File

@ -0,0 +1,125 @@
-- -------------------------------------------------------------------- --
-- Phoca Maps Download manual installation --
-- -------------------------------------------------------------------- --
-- See documentation on https://www.phoca.cz/ --
-- --
-- Change all prefixes #__ to prefix which is set in your Joomla! site --
-- (e.g. from #__phocamaps to jos_phocamaps) --
-- Run this SQL queries in your database tool, e.g. in phpMyAdmin --
-- If you have questions, just ask in Phoca Forum --
-- https://www.phoca.cz/forum/ --
-- -------------------------------------------------------------------- --
CREATE TABLE IF NOT EXISTS `#__phocamaps_map` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`alias` varchar(255) NOT NULL default '',
`width` varchar(50) NOT NULL default '',
`height` varchar(50) NOT NULL default '',
`latitude` varchar(20) NOT NULL default '',
`longitude` varchar(20) NOT NULL default '',
`zoom` int(3) NOT NULL default '0',
`lang` varchar(6) NOT NULL default '',
`border` tinyint(1) NOT NULL default '0',
`continuouszoom` tinyint(1) NOT NULL default '0',
`doubleclickzoom` tinyint(1) NOT NULL default '0',
`scrollwheelzoom` tinyint(1) NOT NULL default '0',
`gesturehandling` varchar(100) NOT NULL default '',
`zoomcontrol` tinyint(1) NOT NULL default '0',
`scalecontrol` tinyint(1) NOT NULL default '0',
`typeid` tinyint(1) NOT NULL default '0',
`typecontrol` tinyint(1) NOT NULL default '0',
`typecontrolposition` tinyint(1) NOT NULL default '0',
`collapsibleoverview` tinyint(1) NOT NULL default '0',
`dynamiclabel` tinyint(1) NOT NULL default '0',
`googlebar` tinyint(1) NOT NULL default '0',
`displayroute` tinyint(1) NOT NULL default '0',
`kmlfile` varchar(255) NOT NULL default '',
`custom_options` varchar(255) NOT NULL default '',
`map_styles` text,
`trackfiles_osm` varchar(255) NOT NULL default '',
`trackcolors_osm` varchar(255) NOT NULL default '',
`fitbounds_osm` tinyint(1) NOT NULL default '0',
`autolocation` tinyint(1) NOT NULL default '0',
`description` text,
`published` tinyint(1) NOT NULL default '0',
`checked_out` int(11) unsigned NOT NULL default '0',
`checked_out_time` datetime,
`ordering` int(11) NOT NULL default '0',
`access` tinyint(3) unsigned NOT NULL default '0',
`hits` int(11) NOT NULL default '0',
`params` text,
`language` char(7) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `cat_idx` (`published`,`access`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__phocamaps_marker` (
`id` int(11) unsigned NOT NULL auto_increment,
`catid` int(11) NOT NULL default '0',
`title` varchar(250) NOT NULL default '',
`alias` varchar(255) NOT NULL default '',
`latitude` varchar(20) NOT NULL default '',
`longitude` varchar(20) NOT NULL default '',
`gpslatitude` varchar(50) NOT NULL default '',
`gpslongitude` varchar(50) NOT NULL default '',
`displaygps` tinyint(1) NOT NULL default '0',
`icon` tinyint(1) NOT NULL default '0',
`iconext` int(11) NOT NULL default '0',
`description` text,
`osm_icon` varchar(100) NOT NULL default '',
`osm_marker_color` varchar(20) NOT NULL default '',
`osm_icon_color` varchar(20) NOT NULL default '',
`osm_icon_prefix` varchar(20) NOT NULL default '',
`osm_icon_spin` tinyint(1) NOT NULL default '0',
`osm_icon_class` text,
`contentwidth` varchar(8) NOT NULL default '',
`contentheight` varchar(8) NOT NULL default '',
`markerwindow` tinyint(1) NOT NULL default '0',
`published` tinyint(1) NOT NULL default '0',
`checked_out` int(11) unsigned NOT NULL default '0',
`checked_out_time` datetime,
`ordering` int(11) NOT NULL default '0',
`access` tinyint(3) unsigned NOT NULL default '0',
`hits` int(11) NOT NULL default '0',
`params` text,
`language` char(7) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `catid` (`catid`,`published`)
) CHARACTER SET `utf8`;
CREATE TABLE IF NOT EXISTS `#__phocamaps_icon` (
`id` int(11) unsigned NOT NULL auto_increment,
`title` varchar(250) NOT NULL default '',
`alias` varchar(255) NOT NULL default '',
`url` text,
`urls` text,
`object` varchar(255) NOT NULL default '',
`objects` varchar(255) NOT NULL default '',
`objectshape` varchar(255) NOT NULL default '',
`published` tinyint(1) NOT NULL default '0',
`checked_out` int(11) unsigned NOT NULL default '0',
`checked_out_time` datetime,
`ordering` int(11) NOT NULL default '0',
`access` tinyint(3) unsigned NOT NULL default '0',
`hits` int(11) NOT NULL default '0',
`params` text,
`language` char(7) NOT NULL default '',
PRIMARY KEY (`id`)
) CHARACTER SET `utf8`;
INSERT INTO `#__phocamaps_icon` (`id`, `title`, `alias`, `url`, `urls`, `object`, `objects`, `objectshape`, `published`, `checked_out`, `checked_out_time`, `ordering`, `access`, `hits`, `params`, `language`) VALUES
(1, 'Tree', 'tree', 'https://maps.google.com/mapfiles/ms/icons/tree.png', 'https://maps.google.com/mapfiles/ms/icons/tree.shadow.png', '', '59,32;0,0;16,34', 'rect;0,0,25,30', 1, 0, '0000-00-00 00:00:00', 1, 1, 0, '', ''),
(2, 'Pushpin', 'pushpin', 'https://maps.google.com/mapfiles/ms/icons/red-pushpin.png', '', '', '', 'rect;0,0,25,30', 1, 0, '0000-00-00 00:00:00', 2, 1, 0, '', ''),
(3, 'Blue Dot', 'blue-dot', 'https://maps.google.com/mapfiles/ms/icons/blue-dot.png', '', '', '', 'rect;0,0,25,30', 1, 0, '0000-00-00 00:00:00', 3, 1, 0, '', ''),
(4, 'Flag', 'flag', 'https://maps.google.com/mapfiles/ms/icons/flag.png', 'https://maps.google.com/mapfiles/ms/icons/flag.shadow.png', '', '59,32;0,0;16,34', 'rect;0,0,25,30', 1, 0, '0000-00-00 00:00:00', 3, 1, 0, '', ''),
(5, 'Info', 'info', 'https://maps.google.com/mapfiles/ms/icons/info.png', 'https://maps.google.com/mapfiles/ms/icons/info.shadow.png', '', '59,32;0,0;16,34', 'rect;0,0,25,30', 1, 0, '0000-00-00 00:00:00', 5, 1, 0, '', ''),
(6, 'Snack Bar', 'snack-bar', 'https://maps.google.com/mapfiles/ms/icons/snack_bar.png', 'https://maps.google.com/mapfiles/ms/icons/snack_bar.shadow.png', '', '59,32;0,0;16,34', 'rect;0,0,32,30', 1, 0, '0000-00-00 00:00:00', 6, 1, 0, '', '');
-- UTF-8 test: <20>,<2C>,<2C>

View File

@ -0,0 +1,3 @@
DROP TABLE IF EXISTS `#__phocamaps_map`;
DROP TABLE IF EXISTS `#__phocamaps_marker`;
DROP TABLE IF EXISTS `#__phocamaps_icon`;

View File

@ -0,0 +1,583 @@
<?php
/**
* @package Phoca Cart
* @author Jan Pavelka - https://www.phoca.cz
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
* @cms Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
namespace Phoca\Render;
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\HTML\Helpers\Sidebar;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Version;
use Joomla\CMS\Layout\FileLayout;
class Adminview
{
public $view = '';
public $viewtype = 2;
public $option = '';
public $optionLang = '';
public $compatible = false;
public $sidebar = true;
protected $document = false;
public function __construct(){
$app = Factory::getApplication();
$version = new Version();
$this->compatible = $version->isCompatible('4.0.0-alpha');
$this->view = $app->input->get('view');
$this->option = $app->input->get('option');
$this->optionLang = strtoupper($this->option);
$this->sidebar = Factory::getApplication()->getTemplate(true)->params->get('menu', 1) ? true : false;
$this->document = Factory::getDocument();
$wa = $app->getDocument()->getWebAssetManager();
HTMLHelper::_('behavior.formvalidator');
HTMLHelper::_('behavior.keepalive');
HTMLHelper::_('jquery.framework', false);
$wa->registerAndUseStyle($this->option . '.font', 'media/' . $this->option . '/duotone/joomla-fonts.css', array('version' => 'auto'));
$wa->registerAndUseStyle($this->option . '.main', 'media/' .$this->option . '/css/administrator/'.str_replace('com_', '', $this->option).'.css', array('version' => 'auto'));
$wa->registerAndUseStyle($this->option . '.version', 'media/' .$this->option . '/css/administrator/4.css', array('version' => 'auto'));
$wa->registerAndUseStyle($this->option . '.theme', 'media/' .$this->option . '/css/administrator/theme-dark.css', array('version' => 'auto'), [], ['template.active']);
}
public function startHeader() {
$layoutSVG = new FileLayout('svg_definitions', null, array('component' => $this->option));
return $layoutSVG->render(array());
}
public function startCp() {
// CSS based on user groups
$user = Factory::getUser();
$groupClass = '';
if (!empty($user->groups)) {
foreach ($user->groups as $k => $v) {
$groupClass .= ' group-'. $v;
}
}
$o = array();
if ($this->compatible) {
if ($this->sidebar) {
$o[] = '<div class="ph-group-class '.$groupClass.'">';
} else {
$o[] = '<div class="row '.$groupClass.'">';
$o[] = '<div id="j-main-container" class="col-md-2">'. Sidebar::render().'</div>';
$o[] = '<div id="j-main-container" class="col-md-10">';
}
} else {
$o[] = '<div id="j-sidebar-container" class="span2">' . Sidebar::render() . '</div>'."\n";
$o[] = '<div id="j-main-container" class="span10">'."\n";
}
return implode("\n", $o);
}
public function endCp() {
$o = array();
if ($this->compatible) {
if ($this->sidebar) {
$o[] = '</div>';// end groupClass
} else {
$o[] = '</div></div>';
}
} else {
$o[] = '</div>';
}
return implode("\n", $o);
}
public function startForm($option, $view, $itemId, $id = 'adminForm', $name = 'adminForm', $class = '', $layout = 'edit', $tmpl = '') {
if ($layout != '') {
$layout = '&layout='.$layout;
}
if ($view != '') {
$viewP = '&view='.$view;
}
if ($tmpl != '') {
$tmpl = '&tmpl='.$tmpl;
}
$containerClass = 'container';
if ($this->compatible) {
$containerClass = '';
}
// CSS based on user groups
$user = Factory::getUser();
$groupClass = '';
if (!empty($user->groups)) {
foreach ($user->groups as $k => $v) {
$groupClass .= ' group-'. $v;
}
}
return '<div id="'.$view.'" class="'.$groupClass.'"><form action="'.Route::_('index.php?option='.$option . $viewP . $layout . '&id='.(int) $itemId . $tmpl).'" method="post" name="'.$name.'" id="'.$id.'" class="form-validate '.$class.'" role="form">'."\n"
.'<div id="phAdminEdit" class="'.$containerClass.'"><div class="row">'."\n";
}
public function endForm() {
return '</div></div>'."\n".'</form>'."\n".'</div>'. "\n" . $this->ajaxTopHtml();
}
public function startFormRoute($view, $route, $id = 'adminForm', $name = 'adminForm') {
// CSS based on user groups
$user = Factory::getUser();
$groupClass = '';
if (!empty($user->groups)) {
foreach ($user->groups as $k => $v) {
$groupClass .= ' group-'. $v;
}
}
return '<div id="'.$view.'" class="'.$groupClass.'"><form action="'.Route::_($route).'" method="post" name="'.$name.'" id="'.$id.'" class="form-validate">'."\n"
.'<div id="phAdminEdit" class="row">'."\n";
}
public function ajaxTopHtml($text = '') {
$o = '<div id="ph-ajaxtop">';
if ($text != '') {
$o .= '<div id="ph-ajaxtop-message"><div class="ph-loader-top"></div> '. strip_tags(addslashes($text)) . '</div>';
}
$o .= '</div>';
return $o;
}
public function formInputs($task = '') {
$o = '';
$o .= '<input type="hidden" name="task" value="" />'. "\n";
if ($task != '') {
$o .= '<input type="hidden" name="taskgroup" value="'.strip_tags($task).'" />'. "\n";
}
$o .= HTMLHelper::_('form.token'). "\n";
return $o;
}
public function groupHeader($form, $formArray , $image = '', $formArraySuffix = array(), $realSuffix = 0) {
$md = 6;
$columns = 12;
$count = count($formArray);
if ($image != '') {
$mdImage = 2;
$columns = 10;
}
$md = round(($columns/(int)$count), 0);
$md = $md == 0 ? 1 : $md;
$o = '';
$o .= '<div class="row title-alias form-vertical mb-3">';
if (!empty($formArray)) {
foreach ($formArray as $k => $v) {
// Suffix below input
if (isset($formArraySuffix[$k]) && $formArraySuffix[$k] != '' && $formArraySuffix[$k] != '<small>()</small>') {
if ($realSuffix) {
$value = $form->getInput($v) .' '. $formArraySuffix[$k];
} else {
$value = $formArraySuffix[$k];
}
} else {
$value = $form->getInput($v);
}
$o .= '<div class="col-12 col-md-'.(int)$md.'">';
$o .= '<div class="control-group ph-par-'.$v.'">'."\n"
. '<div class="control-label">'. $form->getLabel($v) . '</div>'."\n"
. '<div class="clearfix"></div>'. "\n"
. '<div>' . $value. '</div>'."\n"
. '<div class="clearfix"></div>' . "\n"
. '</div>'. "\n";
$o .= '</div>';
}
}
if ($image != '') {
$o .= '<div class="col-12 col-md-'.(int)$mdImage.'">';
$o .= '<div class="ph-admin-additional-box-img-box">'.$image.'</div>';
$o .= '</div>';
}
$o .= '</div>';
return $o;
}
public function group($form, $formArray, $clear = 0) {
$o = '';
if (!empty($formArray)) {
if ($clear == 1) {
foreach ($formArray as $value) {
$description = Text::_($form->getFieldAttribute($value, 'description'));
$descriptionOutput = '';
if ($description != '') {
$descriptionOutput = '<div role="tooltip">'.$description.'</div>';
}
$o .=
'<div class="control-group-clear ph-par-'.$value.'">'."\n"
.'<div class="control-label">'. $form->getLabel($value) . $descriptionOutput . '</div>'."\n"
//. '<div class="clearfix"></div>'. "\n"
. '<div>' . $form->getInput($value). '</div>'."\n"
. '<div class="clearfix"></div>' . "\n"
. '</div>'. "\n";
}
} else {
foreach ($formArray as $value) {
$description = Text::_($form->getFieldAttribute($value, 'description'));
$descriptionOutput = '';
if ($description != '') {
$descriptionOutput = '<div role="tooltip">'.$description.'</div>';
}
//$o .= $form->renderField($value) ;
$o .= '<div class="control-group ph-par-'.$value.'">'."\n"
. '<div class="control-label">'. $form->getLabel($value) . $descriptionOutput . '</div>'
. '<div class="controls">' . $form->getInput($value). '</div>'."\n"
. '</div>' . "\n";
}
}
}
return $o;
}
public function item($form, $item, $suffix = '', $realSuffix = 0) {
$value = $o = '';
if ($suffix != '' && $suffix != '<small>()</small>') {
if ($realSuffix) {
$value = $form->getInput($item) .' '. $suffix;
} else {
$value = $suffix;
}
} else {
$value = $form->getInput($item);
}
$description = Text::_($form->getFieldAttribute($item, 'description'));
$descriptionOutput = '';
if ($description != '') {
$descriptionOutput = '<div role="tooltip">'.$description.'</div>';
}
$o .= '<div class="control-group ph-par-'.$item.'">'."\n";
$o .= '<div class="control-label">'. $form->getLabel($item) . $descriptionOutput . '</div>'."\n"
. '<div class="controls">' . $value.'</div>'."\n"
. '</div>' . "\n";
return $o;
}
public function itemLabel($item, $label, $description = '', $name = '') {
$description = Text::_($description);
$descriptionOutput = '';
if ($description != '') {
$descriptionOutput = '<div role="tooltip">'.$description.'</div>';
}
$o = '';
$o .= '<div class="control-group ph-par-'.$name.'">'."\n";
$o .= '<div class="control-label"><label>'. $label .'</label>'. $descriptionOutput . '</div>'."\n"
. '<div class="controls">' . $item.'</div>'."\n"
. '</div>' . "\n";
return $o;
}
public function itemText($item, $label, $class = '', $name = '') {
$o = '';
$o .= '<div class="control-group ph-par-ph-text-'.$name.' ph-control-group-text">'."\n";
$o .= '<div class="control-label"><label>'. $label . '</label></div>'."\n"
. '<div class="controls '.$class.'">' . $item.'</div>'."\n"
. '</div>' . "\n";
return $o;
}
public static function getCalendarDate($dateCustom) {
$config = Factory::getConfig();
$user = Factory::getUser();
$filter = 'USER_UTC';//'SERVER_UTC'
switch (strtoupper($filter)){
case 'SERVER_UTC':
if ($dateCustom && $dateCustom != Factory::getDbo()->getNullDate()) {
$date = Factory::getDate($dateCustom, 'UTC');
$date->setTimezone(new \DateTimeZone($config->get('offset')));
$dateCustom = $date->format('Y-m-d H:i:s', true, false);
}
break;
case 'USER_UTC':
if ($dateCustom && $dateCustom != Factory::getDbo()->getNullDate()) {
$date = Factory::getDate($dateCustom, 'UTC');
$date->setTimezone(new \DateTimeZone($user->getParam('timezone', $config->get('offset'))));
$dateCustom = $date->format('Y-m-d H:i:s', true, false);
}
break;
}
return $dateCustom;
}
/* CP */
public function quickIconButton( $link, $text = '', $icon = '', $color = '', $item = '') {
$o = '<div class="ph-cp-item '.$item.'-item-box">';
$o .= ' <div class="ph-cp-item-icon">';
$o .= ' <a class="ph-cp-item-icon-link" href="'.$link.'"><span style="background-color: '.$color.'20;"><i style="color: '.$color.';" class="phi '.$icon.' ph-cp-item-icon-link-large"></i></span></a>';
$o .= ' </div>';
$o .= ' <div class="ph-cp-item-title"><a class="ph-cp-item-title-link" href="'.$link.'"><span>'.$text.'</span></a></div>';
$o .= '</div>';
return $o;
}
public function getLinks($internalLinksOnly = 0) {
$links = array();
switch ($this->option) {
case 'com_phocacart':
$links[] = array('Phoca Cart site', 'https://www.phoca.cz/phocacart');
$links[] = array('Phoca Cart documentation site', 'https://www.phoca.cz/documentation/category/116-phoca-cart-component');
$links[] = array('Phoca Cart download site', 'https://www.phoca.cz/download/category/100-phoca-cart-component');
$links[] = array('Phoca Cart extensions', 'https://www.phoca.cz/phocacart-extensions');
break;
case 'com_phocamenu':
$links[] = array('Phoca Restaurant Menu site', 'https://www.phoca.cz/phocamenu');
$links[] = array('Phoca Restaurant Menu documentation site', 'https://www.phoca.cz/documentation/category/52-phoca-restaurant-menu-component');
$links[] = array('Phoca Restaurant Menu download site', 'https://www.phoca.cz/download/category/36-phoca-restaurant-menu-component');
break;
case 'com_phocagallery':
$links[] = array('Phoca Gallery site', 'https://www.phoca.cz/phocagallery');
$links[] = array('Phoca Gallery documentation site', 'https://www.phoca.cz/documentation/category/2-phoca-gallery-component');
$links[] = array('Phoca Gallery download site', 'https://www.phoca.cz/download/category/66-phoca-gallery');
break;
}
$links[] = array('Phoca News', 'https://www.phoca.cz/news');
$links[] = array('Phoca Forum', 'https://www.phoca.cz/forum');
if ($internalLinksOnly == 1) {
return $links;
}
$components = array();
$components[] = array('Phoca Gallery','phocagallery', 'pg');
$components[] = array('Phoca Guestbook','phocaguestbook', 'pgb');
$components[] = array('Phoca Download','phocadownload', 'pd');
$components[] = array('Phoca Documentation','phocadocumentation', 'pdc');
$components[] = array('Phoca Favicon','phocafavicon', 'pfv');
$components[] = array('Phoca SEF','phocasef', 'psef');
$components[] = array('Phoca PDF','phocapdf', 'ppdf');
$components[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
$components[] = array('Phoca Maps','phocamaps', 'pm');
$components[] = array('Phoca Font','phocafont', 'pf');
$components[] = array('Phoca Email','phocaemail', 'pe');
$components[] = array('Phoca Install','phocainstall', 'pi');
$components[] = array('Phoca Template','phocatemplate', 'pt');
$components[] = array('Phoca Panorama','phocapanorama', 'pp');
$components[] = array('Phoca Commander','phocacommander', 'pcm');
$components[] = array('Phoca Photo','phocaphoto', 'ph');
$components[] = array('Phoca Cart','phocacart', 'pc');
$banners = array();
$banners[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
$banners[] = array('Phoca Cart','phocacart', 'pc');
$o = '';
$o .= '<p>&nbsp;</p>';
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($this->optionLang.'_USEFUL_LINKS'). '</h4>';
$o .= '<ul>';
foreach ($links as $k => $v) {
$o .= '<li><a style="text-decoration:underline" href="'.$v[1].'" target="_blank">'.$v[0].'</a></li>';
}
$o .= '</ul>';
$o .= '<div>';
$o .= '<p>&nbsp;</p>';
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($this->optionLang.'_USEFUL_TIPS'). '</h4>';
$m = mt_rand(0, 10);
if ((int)$m > 0) {
$o .= '<div>';
$num = range(0,(count($components) - 1 ));
shuffle($num);
for ($i = 0; $i<3; $i++) {
$numO = $num[$i];
$o .= '<div style="float:left;width:33%;margin:0 auto;">';
$o .= '<div><a style="text-decoration:underline;" href="https://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'.HTMLHelper::_('image', 'media/'.$this->option.'/images/administrator/icon-box-'.$components[$numO][2].'.png', ''). '</a></div>';
$o .= '<div style="margin-top:-10px;"><small><a style="text-decoration:underline;" href="https://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'.$components[$numO][0].'</a></small></div>';
$o .= '</div>';
}
$o .= '<div style="clear:both"></div>';
$o .= '</div>';
} else {
$num = range(0,(count($banners) - 1 ));
shuffle($num);
$numO = $num[0];
$o .= '<div><a href="https://www.phoca.cz/'.$banners[$numO][1].'" target="_blank">'.HTMLHelper::_('image', 'media/'.$this->option.'/images/administrator/b-'.$banners[$numO][2].'.png', ''). '</a></div>';
}
$o .= '<p>&nbsp;</p>';
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($this->optionLang.'_PLEASE_READ'). '</h4>';
$o .= '<div><a style="text-decoration:underline" href="https://www.phoca.cz/phoca-needs-your-help/" target="_blank">'.Text::_($this->optionLang.'_PHOCA_NEEDS_YOUR_HELP'). '</a></div>';
$o .= '</div>';
return $o;
}
// TABS
public function navigation($tabs, $activeTab = '') {
if ($this->compatible) {
return '';
}
$o = '<ul class="nav nav-tabs">';
$i = 0;
foreach($tabs as $k => $v) {
$cA = 0;
if ($activeTab != '') {
if ($activeTab == $k) {
$cA = 'class="active"';
}
} else {
if ($i == 0) {
$cA = 'class="active"';
}
}
$o .= '<li '.$cA.'><a href="#'.$k.'" data-bs-toggle="tab">'. $v.'</a></li>'."\n";
$i++;
}
$o .= '</ul>';
return $o;
}
public function startTabs($active = 'general') {
if ($this->compatible) {
return HTMLHelper::_('uitab.startTabSet', 'myTab', array('active' => $active));
} else {
return '<div id="phAdminEditTabs" class="tab-content">'. "\n";
}
}
public function endTabs() {
if ($this->compatible) {
return HTMLHelper::_('uitab.endTabSet');
} else {
return '</div>';
}
}
public function startTab($id, $name, $active = '') {
if ($this->compatible) {
return HTMLHelper::_('uitab.addTab', 'myTab', $id, $name);
} else {
return '<div class="tab-pane '.$active.'" id="'.$id.'">'."\n";
}
}
public function endTab() {
if ($this->compatible) {
return HTMLHelper::_('uitab.endTab');
} else {
return '</div>';
}
}
public function itemCalc($id, $name, $value, $form = 'pform', $size = 1, $class = '') {
switch ($size){
case 3: $class = 'form-control input-xxlarge'. ' ' . $class;
break;
case 2: $class = 'form-control input-xlarge'. ' ' . $class;
break;
case 0: $class = 'form-control input-mini'. ' ' . $class;
break;
default: $class= 'form-control input-small'. ' ' . $class;
break;
}
$o = '';
$o .= '<input type="text" name="'.$form.'['.(int)$id.']['.htmlspecialchars($name, ENT_QUOTES, 'UTF-8').']" id="'.$form.'_'.(int)$id.'_'.htmlspecialchars($name, ENT_QUOTES, 'UTF-8').'" value="'.htmlspecialchars($value, ENT_QUOTES, 'UTF-8').'" class="'.htmlspecialchars($class, ENT_QUOTES, 'UTF-8').'" />';
return $o;
}
public function itemCalcCheckbox($id, $name, $value, $form = 'pform' ) {
$checked = '';
if ($value == 1) {
$checked = 'checked="checked"';
}
$o = '';
$o .= '<input type="checkbox" name="'.$form.'['.(int)$id.']['.htmlspecialchars($name, ENT_QUOTES, 'UTF-8').']" id="'.$form.'_'.(int)$id.'_'.htmlspecialchars($name, ENT_QUOTES, 'UTF-8').'" '.$checked.' />';
return $o;
}
}
?>

View File

@ -0,0 +1,521 @@
<?php
/**
* @package Phoca Cart
* @author Jan Pavelka - https://www.phoca.cz
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
* @cms Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
namespace Phoca\Render;
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\Helpers\Sidebar;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Version;
class Adminviews
{
public $view = '';
public $viewtype = 1;
public $option = '';
public $optionLang = '';
public $tmpl = '';
public $compatible = false;
public $sidebar = true;
protected $document = false;
public function __construct() {
$app = Factory::getApplication();
$version = new Version();
$this->compatible = $version->isCompatible('4.0.0-alpha');
$this->view = $app->input->get('view');
$this->option = $app->input->get('option');
$this->optionLang = strtoupper($this->option);
$this->sidebar = Factory::getApplication()->getTemplate(true)->params->get('menu', 1) ? true : false;
$this->document = Factory::getDocument();
$wa = $app->getDocument()->getWebAssetManager();
HTMLHelper::_('bootstrap.tooltip');
HTMLHelper::_('behavior.multiselect');
HTMLHelper::_('dropdown.init');
HTMLHelper::_('jquery.framework', false);
$wa->registerAndUseStyle($this->option . '.font', 'media/' . $this->option . '/duotone/joomla-fonts.css', array('version' => 'auto'));
$wa->registerAndUseStyle($this->option . '.main', 'media/' .$this->option . '/css/administrator/'.str_replace('com_', '', $this->option).'.css', array('version' => 'auto'));
$wa->registerAndUseStyle($this->option . '.version', 'media/' .$this->option . '/css/administrator/4.css', array('version' => 'auto'));
$wa->registerAndUseStyle($this->option . '.theme', 'media/' .$this->option . '/css/administrator/theme-dark.css', array('version' => 'auto'), [], ['template.active']);
// Modal
if ($this->tmpl == 'component') {
HTMLHelper::_('behavior.core');
HTMLHelper::_('behavior.polyfill', array('event'), 'lt IE 9');
//HTMLHelper::_('script', 'media/' . $this->option . '/js/administrator/admin-phocaitems-modal.min.js', array('version' => 'auto', 'relative' => true));
HTMLHelper::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom'));
HTMLHelper::_('bootstrap.popover', '.hasPopover', array('placement' => 'bottom'));
}
}
public function startHeader() {
$layoutSVG = new FileLayout('svg_definitions', null, array('component' => $this->option));
//return $layoutSVG->render(array());
}
public function startMainContainer($id = 'phAdminView', $class = 'ph-admin-box') {
$o = array();
if ($this->compatible) {
// Joomla! 4
$o[] = '<div class="row">';
if ($this->sidebar) {
$o[] = '<div id="j-main-container" class="col-md-12">';
} else {
$o[] = '<div id="j-sidebar-container" class="col-md-2">' . Sidebar::render() . '</div>';
$o[] = '<div id="j-main-container" class="col-md-10">';
}
} else {
$o[] = '<div id="j-sidebar-container" class="span2">' . Sidebar::render() . '</div>';
$o[] = '<div id="j-main-container" class="span10">';
}
return implode("\n", $o);
}
public function endMainContainer() {
$o = array();
$o[] = '</div>';
if ($this->compatible) {
$o[] = '</div>';
}
return implode("\n", $o);
}
public function jsJorderTable($listOrder) {
$js = 'Joomla.orderTable = function() {' . "\n"
. ' table = document.getElementById("sortTable");' . "\n"
. ' direction = document.getElementById("directionTable");' . "\n"
. ' order = table.options[table.selectedIndex].value;' . "\n"
. ' if (order != \'' . $listOrder . '\') {' . "\n"
. ' dirn = \'asc\';' . "\n"
. ' } else {' . "\n"
. ' dirn = direction.options[direction.selectedIndex].value;' . "\n"
. ' }' . "\n"
. ' Joomla.tableOrdering(order, dirn, \'\');' . "\n"
. '}' . "\n";
Factory::getDocument()->addScriptDeclaration($js);
}
public function startForm($option, $view, $id = 'adminForm', $name = 'adminForm') {
// CSS based on user groups
$user = Factory::getUser();
$groupClass = '';
if (!empty($user->groups)) {
foreach ($user->groups as $k => $v) {
$groupClass .= ' group-'. $v;
}
}
return '<div id="' . $view . '" class="'.$groupClass.'"><form action="' . Route::_('index.php?option=' . $option . '&view=' . $view) . '" method="post" name="' . $name . '" id="' . $id . '">' . "\n" . '';
}
public function startFormModal($option, $view, $id = 'adminForm', $name = 'adminForm', $function = '') {
// CSS based on user groups
$user = Factory::getUser();
$groupClass = '';
if (!empty($user->groups)) {
foreach ($user->groups as $k => $v) {
$groupClass .= ' group-'. $v;
}
}
return '<div id="' . $view . '" class="'.$groupClass.'"><form action="' . Route::_('index.php?option=' . $option . '&view=' . $view . '&layout=modal&tmpl=component&function=' . $function . '&' . Session::getFormToken() . '=1') . '" method="post" name="' . $name . '" id="' . $id . '">' . "\n" . '';
}
public function endForm() {
return '</form>' . "\n" . '' . "\n" . $this->ajaxTopHtml();
}
public function ajaxTopHtml($text = '') {
$o = '<div id="ph-ajaxtop">';
if ($text != '') {
$o .= '<div id="ph-ajaxtop-message"><div class="ph-loader-top"></div> ' . strip_tags(addslashes($text)) . '</div>';
}
$o .= '</div>';
return $o;
}
/* Modal */
public function startMainContainerNoSubmenu() {
//return '<div id="j-main-container" class="col-xs-12 col-sm-10 col-md-10">'. "\n";
$o = '<div id="j-main-container" class="col-xs-12 col-sm-12 col-md-12 ph-admin-box-content ph-admin-manage">' . "\n";
$o .= '<div id="ph-system-message-container"></div>' . "\n";// specific container for moving messages from joomla to phoca
//$this->moveSystemMessageFromJoomlaToPhoca();
return $o;
}
public function moveSystemMessageFromJoomlaToPhoca() {
$s = array();
//$s[] = 'document.getElementById("system-message-container").style.display = "none";';
$s[] = 'jQuery(document).ready(function() {';
//$s[] = ' jQuery("#system-message-container").removeClass("j-toggle-main");';
$s[] = ' jQuery("#system-message-container").css("display", "none");';
$s[] = ' var phSystemMsg = jQuery("#system-message-container").html();';
$s[] = ' jQuery("#ph-system-message-container").html(phSystemMsg);';
$s[] = '});';
Factory::getDocument()->addScriptDeclaration(implode("\n", $s));
}
public function startTable($id, $class = '') {
return '<table class="table table-striped '.$class.'" id="' . $id . '">' . "\n";
}
public function endTable() {
return '</table>' . "\n";
}
public function tblFoot($listFooter, $columns) {
return '<tfoot>' . "\n" . '<tr><td colspan="' . (int)$columns . '">' . $listFooter . '</td></tr>' . "\n" . '</tfoot>' . "\n";
}
public function startTblHeader() {
return '<thead>' . "\n" . '<tr>' . "\n";
}
public function endTblHeader() {
return '</tr>' . "\n" . '</thead>' . "\n";
}
public function thOrderingXML($txtHo, $listDirn, $listOrder, $prefix = 'a', $empty = false) {
if ($empty) {
return '<th class="nowrap center ph-ordering"></th>' . "\n";
}
return '<th class="nowrap center ph-ordering">' . "\n"
. HTMLHelper::_('searchtools.sort', '', strip_tags($prefix) . '.ordering', $listDirn, $listOrder, null, 'asc', $txtHo, 'icon-menu-2') . "\n"
. '</th>';
//HTMLHelper::_('searchtools.sort', $this->t['l'].'_IN_STOCK', 'a.stock', $listDirn, $listOrder ).'</th>'."\n";
}
public function thCheck($txtCh) {
return '<th class=" ph-check">' . "\n"
. '<input type="checkbox" name="checkall-toggle" value="" title="' . Text::_($txtCh) . '" onclick="Joomla.checkAll(this)" />' . "\n"
. '</th>' . "\n";
}
public function tdOrder($canChange, $saveOrder, $orderkey, $ordering = 0, $catOrderingEnabled = true) {
$o = '<td class="order nowrap center ">' . "\n";
if ($canChange) {
$disableClassName = '';
$disabledLabel = '';
if (!$saveOrder) {
$disabledLabel = Text::_('JORDERINGDISABLED');
$disableClassName = 'inactive tip-top';
}
if (!$catOrderingEnabled && !$saveOrder) {
//$disableClassName = 'inactive tip-top';
$disabledLabel = Text::_($this->optionLang . '_SELECT_CATEGORY_TO_ORDER_ITEMS');
}
$o .= '<span class="sortable-handler hasTooltip ' . $disableClassName . '" title="' . $disabledLabel . '"><i class="icon-menu"></i></span>' . "\n";
} else {
$o .= '<span class="sortable-handler inactive"><i class="icon-menu"></i></span>' . "\n";
}
$orderkeyPlus = $ordering; //$orderkey + 1;
$o .= '<input type="text" style="display:none" name="order[]" size="5" value="' . $orderkeyPlus . '" />' . "\n"
. '</td>' . "\n";
return $o;
}
public function tdRating($ratingAvg) {
$o = '<td class="small ">';
$voteAvg = round(((float)$ratingAvg / 0.5)) * 0.5;
$voteAvgWidth = 16 * $voteAvg;
$o .= '<ul class="star-rating-small">'
. '<li class="current-rating" style="width:' . $voteAvgWidth . 'px"></li>'
. '<li><span class="star1"></span></li>';
for ($ir = 2; $ir < 6; $ir++) {
$o .= '<li><span class="stars' . $ir . '"></span></li>';
}
$o .= '</ul>';
$o .= '</td>' . "\n";
return $o;
}
public function tdLanguage($lang, $langTitle, $langTitleE) {
$o = '<td class="small nowrap ">';
if ($lang == '*') {
$o .= Text::_('JALL');
} else {
if ($langTitle) {
$o .= $langTitleE;
} else {
$o .= Text::_('JUNDEFINED');
}
}
$o .= '</td>' . "\n";
return $o;
}
public function tdEip($id, $value, $params = array()) {
$classBox = isset($params['classbox']) ? $params['clasbox'] : 'small';
$classEip = isset($params['classeip']) ? $params['classeip'] : 'ph-editinplace-text ph-eip-text ph-eip-price';
$o = array();
$o[] = '<td class="' . $classBox . '">';
$o[] = '<span class="' . $classEip . '" id="' . $id . '">' . $value . '</span>';
$o[] = '</td>';
return implode("\n", $o);
}
public function formInputsXml($listOrder, $listDirn, $originalOrders) {
return '<input type="hidden" name="task" value="" />' . "\n"
. '<input type="hidden" name="boxchecked" value="0" />' . "\n"
//.'<input type="hidden" name="filter_order" value="'.$listOrder.'" />'. "\n"
//.'<input type="hidden" name="filter_order_Dir" value="'.$listDirn.'" />'. "\n"
. HTMLHelper::_('form.token') . "\n"
. '<input type="hidden" name="original_order_values" value="' . implode(',', $originalOrders) . '" />' . "\n";
}
public function td($value, $class = '', $tag = 'td') {
// th for columns which cannot be hidden (Joomla feature);
if ($class != '') {
return '<'.$tag.' class="' . $class . '">' . $value . '</'.$tag.'>' . "\n";
} else {
return '<'.$tag.'>' . $value . '</'.$tag.'>' . "\n";
}
}
public function tdPublishDownUp($publishUp, $publishDown, $class = '') {
$o = '';
$db = Factory::getDBO();
//$app = Factory::getApplication();
$nullDate = $db->getNullDate();
$now = Factory::getDate();
$config = Factory::getConfig();
$publish_up = Factory::getDate($publishUp);
$publish_down = Factory::getDate($publishDown);
$tz = new \DateTimeZone($config->get('offset'));
$publish_up->setTimezone($tz);
$publish_down->setTimezone($tz);
if ($now->toUnix() <= ($publish_up->toUnix())) { // Possible $publish_up->toUnix() - 1 for lazy servers where e.g. when multiple add, pending is displayed instead of active, because it is faster then SQL date
$text = Text::_($this->optionLang . '_PENDING');
} else if (($now->toUnix() <= $publish_down->toUnix() || $publishDown == $nullDate)) {
$text = Text::_($this->optionLang . '_ACTIVE');
} else if ($now->toUnix() > $publish_down->toUnix()) {
$text = Text::_($this->optionLang . '_EXPIRED');
}
$times = '';
if (isset($publishUp)) {
if ($publishUp == $nullDate) {
$times .= Text::_($this->optionLang . '_START') . ': ' . Text::_($this->optionLang . '_ALWAYS');
} else {
$times .= Text::_($this->optionLang . '_START') . ": " . $publish_up->format("D, d M Y H:i:s");
}
}
if (isset($publishDown)) {
if ($publishDown == $nullDate) {
$times .= "<br />" . Text::_($this->optionLang . '_FINISH') . ': ' . Text::_($this->optionLang . '_NO_EXPIRY');
} else {
$times .= "<br />" . Text::_($this->optionLang . '_FINISH') . ": " . $publish_down->format("D, d M Y H:i:s");
}
}
if ($times) {
$o .= '<td align="center" class="'.$class.'">'
. '<span class="editlinktip hasTip" title="' . Text::_($this->optionLang . '_PUBLISH_INFORMATION') . '::' . $times . '">'
. '<a href="javascript:void(0);" >' . $text . '</a></span>'
. '</td>' . "\n";
} else {
$o .= '<td></td>' . "\n";
}
return $o;
}
public function saveOrder($t, $listDirn, $catid = 0) {
$saveOrderingUrl = 'index.php?option=' . $t['o'] . '&task=' . $t['tasks'] . '.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
// Joomla BUG: https://github.com/joomla/joomla-cms/issues/36346 $this->t['catid']
// Add catid to the URL instead of sending in POST
// administrator/components/com_phocacart/views/phocacartitems/tmpl/default.php 37
if ((int)$catid > 0) {
$saveOrderingUrl .= '&catid='.(int)$catid;
}
// ---
if ($this->compatible) {
HTMLHelper::_('draggablelist.draggable');
} else {
HTMLHelper::_('sortablelist.sortable', 'categoryList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
}
return $saveOrderingUrl;
}
public function firstColumnHeader($listDirn, $listOrder, $prefix = 'a', $empty = false) {
if ($this->compatible) {
return '<th class="w-1 text-center ph-check">' . HTMLHelper::_('grid.checkall') . '</td>';
} else {
return $this->thOrderingXML('JGRID_HEADING_ORDERING', $listDirn, $listOrder, $prefix, $empty);
}
}
public function secondColumnHeader($listDirn, $listOrder, $prefix = 'a', $empty = false) {
if ($this->compatible) {
return $this->thOrderingXML('JGRID_HEADING_ORDERING', $listDirn, $listOrder, $prefix, $empty);
} else {
return $this->thCheck('JGLOBAL_CHECK_ALL');
}
}
public function startTblBody($saveOrder, $saveOrderingUrl, $listDirn) {
$o = array();
if ($this->compatible) {
$o[] = '<tbody';
if ($saveOrder) {
$o[] = ' class="js-draggable" data-url="' . $saveOrderingUrl . '" data-direction="' . strtolower($listDirn) . '" data-nested="true"';
}
$o[] = '>';
} else {
$o[] = '<tbody>' . "\n";
}
return implode("", $o);
}
public function endTblBody() {
return '</tbody>' . "\n";
}
public function startTr($i, $catid = 0, $id = 0, $level = -1, $parentsString = '', $class = '') {
$i2 = $i % 2;
$dataItemId = '';
if ($id > 0) {
$dataItemId = ' data-item-id="'.(int)$id.'"';
}
$dataItemCatid = '';
if ($this->compatible) {
$dataItemCatid = ' data-draggable-group="' . (int)$catid . '"';
} else {
$dataItemCatid = ' sortable-group-id="' . (int)$catid . '"';
}
$dataParents = '';
if ($parentsString != '') {
$dataParents = ' data-parents="'.$parentsString.'"';
} else if ($catid > 0) {
$dataParents = ' data-parents="'.(int)$catid.'"';
}
$dataLevel = '';
if ($level > -1) {
$dataLevel = ' data-parents="'.(int)$level.'"';
}
return '<tr for="cb'.$i.'" class="'.$class.'row' . $i2 . '"'.$dataItemId.$dataItemCatid.$dataParents.$dataLevel.' data-transitions>' . "\n";
}
public function endTr() {
return '</tr>' . "\n";
}
public function createIndentation($level) {
if ((int)$level > 1) {
$intendetation = str_repeat('-&nbsp;', ((int)$level - 1));
return '<div class="ph-intendation">'.$intendetation.'</div>';
}
return "";
}
public function firstColumn($i, $itemId, $canChange, $saveOrder, $orderkey, $ordering, $saveOrderCatSelected = true) {
if ($this->compatible) {
return $this->td(HTMLHelper::_('grid.id', $i, $itemId), 'text-center ph-select-row');
} else {
return $this->tdOrder($canChange, $saveOrder, $orderkey, $ordering, $saveOrderCatSelected);
}
}
public function secondColumn($i, $itemId, $canChange, $saveOrder, $orderkey, $ordering, $saveOrderCatSelected = true, $catid = 0) {
if ($this->compatible) {
$o = array();
$o[] = '<td class="text-center d-none d-md-table-cell">';
$iconClass = '';
if (!$canChange) {
$iconClass = ' inactive';
} else if (!$saveOrderCatSelected) {
$iconClass = ' inactive" title="' . Text::_($this->optionLang . '_SELECT_CATEGORY_TO_ORDER_ITEMS');
} else if (!$saveOrder) {
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
}
$o[] = '<span class="sortable-handler' . $iconClass . '"><span class="fas fa-ellipsis-v" aria-hidden="true"></span></span>';
if ($canChange && $saveOrder) {
$o[] = '<input type="text" name="order[]" size="5" value="' . $ordering . '" class="width-20 text-area-order hidden">';
}
$o[] = '</td>';
return implode("", $o);
} else {
return $this->td(HTMLHelper::_('grid.id', $i, $itemId), "small ");
}
}
}
?>

View File

@ -0,0 +1,36 @@
<?php
/**
* Users who do not have 'composer' to manage dependencies, include this
* file to provide auto-loading of the classes in this library.
*/
spl_autoload_register ( function ($class) {
/*
* PSR-4 autoloader, based on PHP Framework Interop Group snippet (Under MIT License.)
* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
*/
$prefix = "Phoca\\";
$base_dir = __DIR__ . "/";
/* Only continue for classes in this namespace */
$len = strlen ( $prefix );
if (strncmp ( $prefix, $class, $len ) !== 0) {
return;
}
/* Require the file if it exists */
//$relative_class = substr ( $class, $len );
//$relative_class = str_replace('Joomla/CMS/' . $class);
$relative_class = $class;
$file = $base_dir . str_replace ( '\\', '/', $relative_class ) . '.php';
if (file_exists ( $file )) {
require $file;
}
} );

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,57 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
class JFormFieldPhocaHead extends FormField
{
protected $type = 'PhocaHead';
protected function getLabel() { return '';}
protected function getInput() {
$app = Factory::getApplication();
$wa = $app->getDocument()->getWebAssetManager();
$option = 'com_phocamaps';
$wa->registerAndUseStyle($option . '.options', 'media/' .$option . '/css/administrator/phocamapsoptions.css', array('version' => 'auto'));
$wa->registerAndUseStyle($option . '.theme', 'media/' .$option . '/css/administrator/theme-dark.css', array('version' => 'auto'), [], ['template.active']);
//echo '<div style="clear:both;"></div>';
$phocaImage = ( (string)$this->element['phocaimage'] ? $this->element['phocaimage'] : '' );
$image = '';
if ($phocaImage != ''){
$image = HTMLHelper::_('image', 'media/com_phocagallery/images/administrator/'. $phocaImage, '' );
}
if ($this->element['default']) {
if ($image != '') {
return '<div class="ph-options-head">'
.'<div>'. $image.' <strong>'. Text::_($this->element['default']) . '</strong></div>'
.'</div>';
} else {
return '<div class="ph-options-head">'
.'<strong>'. Text::_($this->element['default']) . '</strong>'
.'</div>';
}
} else {
return parent::getLabel();
}
//echo '<div style="clear:both;"></div>';
}
}
?>

View File

@ -0,0 +1,47 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die();
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
class JFormFieldPhocaMapsMap extends FormField
{
protected $type = 'PhocaMapsMap';
protected function getInput() {
$db = Factory::getDBO();
$query = 'SELECT a.title AS text, a.id AS value'
. ' FROM #__phocamaps_map AS a'
. ' WHERE a.published = 1'
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$items = $db->loadObjectList();
$attr = '';
$attr .= $this->required ? ' required aria-required="true"' : '';
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : 'class="form-select"';
array_unshift($items, HTMLHelper::_('select.option', '', '- '.Text::_('COM_PHOCAMAPS_SELECT_MAP').' -', 'value', 'text'));
return HTMLHelper::_('select.genericlist', $items, $this->name, trim($attr), 'value', 'text', $this->value, $this->id );
}
}
?>

View File

@ -0,0 +1,90 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
class JFormFieldPhocaMapsOrdering extends FormField
{
protected $type = 'PhocaMapsOrdering';
protected function getInput() {
// Initialize variables.
$html = array();
$attr = '';
// Get some field values from the form.
$id = (int) $this->form->getValue('id');
if ($this->element['table']) {
switch (strtolower($this->element['table'])) {
case "marker":
$whereLabel = 'catid';
$whereValue = (int) $this->form->getValue('catid');
$table = '#__phocamaps_marker';
break;
default:
case "map":
$whereLabel = '';
$whereValue = '';
$table = '#__phocamaps_map';
break;
case "icon":
$whereLabel = '';
$whereValue = '';
$table = '#__phocamaps_icon';
break;
}
} else {
$whereLabel = '';
$whereValue = '';
$table = '#__phocamaps_map';
}
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
// Build the query for the ordering list.
$query = 'SELECT ordering AS value, title AS text' .
' FROM ' . $table;
if ($whereLabel != '' && $whereValue != '') {
$query .= ' WHERE '.$whereLabel.' = ' . (int) $whereValue;
}
$query .= ' ORDER BY ordering';
// Create a read-only list (no name) with a hidden input to store the value.
if ((string) $this->element['readonly'] == 'true') {
$html[] = HTMLHelper::_('list.ordering', '', $query, trim($attr), $this->value, $id ? 0 : 1);
$html[] = '<input type="hidden" name="'.$this->name.'" value="'.$this->value.'"/>';
}
// Create a regular list.
else {
$html[] = HTMLHelper::_('list.ordering', $this->name, $query, trim($attr), $this->value, $id ? 0 : 1);
}
return implode($html);
}
}

View File

@ -0,0 +1,186 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\HTML\HTMLHelper;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
class JFormFieldPhocaMapsRadio extends FormField
{
protected $type = 'PhocaMapsRadio';
protected function getInput()
{
// Initialize variables.
$html = array();
// Initialize some field attributes.
$class = $this->element['class'] ? ' class="radio '.(string) $this->element['class'].'"' : ' class="radio"';
// Start the radio field output.
$html[] = '<fieldset id="'.$this->id.'"'.$class.'>';
$design = ( (string)$this->element['typedesign'] ? $this->element['typedesign'] : 0 );
if ($design == 1) {
$options = $this->getOptionsDesign1();
}
if ($design == 2) {
$options = $this->getOptionsDesign2();
}
//$output .= '<input class="text_area" type="radio" name="'.$this->name.'" id="'.$this->id.'_id" value="'.(string) $option['value'].'" '.$checked.' />';
// Build the radio field output.
foreach ($options as $i => $option) {
// Initialize some option attributes.
$checked = ((string) $option->value == (string) $this->value) ? ' checked="checked"' : '';
$class = !empty($option->class) ? ' class="'.$option->class.'"' : '';
$disabled = !empty($option->disable) ? ' disabled="disabled"' : '';
// Initialize some JavaScript option attributes.
$onclick = !empty($option->onclick) ? ' onclick="'.$option->onclick.'"' : '';
$html[] = '<div class="form-check"><input class="form-check-input" type="radio" id="'.$this->id.$i.'" name="'.$this->name.'"' .
' value="'.htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8').'"'
.$checked.$class.$onclick.$disabled.'/>';
$html[] = '<label class="form-check-label" for="'.$this->id.$i.'">'. Text::_($option->text). ' '.$option->img.'</label>';
$html[] = '</div>';
/*if ($design == 1) {
$html[] = '<label for="'.$this->id.$i.'"'.$class.' style="width:auto">'. Text::_($option->text). '</label>'
. '<div style="position:relative;float:left;width:30px;margin-left:5px">'.$option->img.'</div><div style="clear:both"></div>';
}
if ($design == 2) {
if($option->imgnr % 3 == 0) {
$cssPart = '';
$htmlPart = '<div style="clear:both"></div>';
} else {
$cssPart ='margin-right:10px;';
$htmlPart = '<div style="clear:both"></div>';
}
$html[] = '<label for="'.$this->id.$i.'" '.$class.' style="width:auto">'. Text::_($option->text). '</label>'
. '<div style="position:relative;float:left;margin:0px;padding:0px;margin-left:5em;margin-top: -2em;'.$cssPart.'">'.$option->img.'</div></div>'. $htmlPart;
}*/
}
// End the radio field output.
$html[] = '</fieldset>';
return implode($html);
}
protected function getOptionsDesign1()
{
$options = array();
foreach ($this->element->children() as $option) {
$tmp = new CMSObject();
if ($option->getName() != 'option') {
continue;
}
$tmp->value = (string) $option['value'];
$tmp->text = trim((string) $option);
switch((int)$option['value']) {
case 1: $optName = 'grey'; break;
case 2: $optName = 'grey'; break;//$optName = 'greywb';the same but other padding
case 3: $optName = 'greyrc'; break;
case 4: $optName = 'black'; break;
default:
case 0: $optName = 'none'; break;
}
if ((int)$option['value'] == 0) {
$tmp->img = '';
} else {
$tmp->img = HTMLHelper::_('image', 'components/com_phocamaps/assets/images/box-'.$optName.'-tl.png', '', array('style' => 'margin:0;padding:0'));
}
//$tmp->class = (string) $option['class'];
//$tmp->onclick = (string) $option['onclick'];
$options[] = $tmp;
}
reset($options);
return $options;
}
protected function getOptionsDesign2()
{
$options = array();
$i = 1;
foreach ($this->element->children() as $option) {
$tmp = new CMSObject();
if ($option->getName() != 'option') {
continue;
}
$tmp->value = (string) $option['value'];
$tmp->text = trim((string) $option);
switch((int)$option['value']) {
case 1: $optName = 'igrey'; break;
case 2: $optName = 'iyellow'; break;
case 3: $optName = 'ihome'; break;
case 4: $optName = 'igreen'; break;
case 5: $optName = 'istar'; break;
case 6: $optName = 'iinfoh'; break;
case 7: $optName = 'iinfoi'; break;
case 8: $optName = 'iinfop'; break;
case 9: $optName = 'iinfoph'; break;
case 10:$optName = 'iinfoz'; break;
default:
case 0: $optName = 'default'; break;
}
if ((int)$option['value'] == 0) {
$tmp->img = '';
$tmp->imgnr = 0;
} else {
$tmp->img = HTMLHelper::_('image', 'media/com_phocamaps/images/'.$optName.'/image.png', '', array('style' => 'margin:0;padding:0'));
$tmp->imgnr = $i;
$i++;
}
//$tmp->class = (string) $option['class'];
//$tmp->onclick = (string) $option['onclick'];
$options[] = $tmp;
}
reset($options);
return $options;
}
}

View File

@ -0,0 +1,40 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectIcon extends FormField
{
public $type = 'PhocaSelectIcon';
protected function getInput() {
$db = Factory::getDBO();
$query = 'SELECT a.title AS text, a.id AS value'
. ' FROM #__phocamaps_icon AS a'
. ' WHERE a.published = 1'
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$items = $db->loadObjectList();
array_unshift($items, HTMLHelper::_('select.option', '', '- '.Text::_('COM_PHOCAMAPS_SELECT_ICON').' -', 'value', 'text'));
return HTMLHelper::_('select.genericlist', $items, $this->name, 'class="form-select"', 'value', 'text', $this->value, $this->id );
}
}
?>

View File

@ -0,0 +1,134 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectMap extends FormField
{
public $type = 'PhocaSelectMap';
protected function getInput()
{
// Initialize variables.
$html = array();
// Initialize some field attributes.
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$maptype = ( (string)$this->element['maptype'] ? $this->element['maptype'] : '' );
if ($this->id == 'jform_latitude') {
// One link for latitude, longitude, zoom
$lat = $this->form->getValue('latitude');
$lng = $this->form->getValue('longitude');
$zoom = $this->form->getValue('zoom');
$suffix = '';
if ($lat != '') { $suffix .= '&amp;lat='.$lat;}
if ($lng != '') { $suffix .= '&amp;lng='.$lng;}
if ($zoom != '' && (int)$zoom > 0) { $suffix .= '&amp;zoom='.$zoom;}
if ($maptype != '') { $suffix .= '&amp;type='.$maptype;}
$link = 'index.php?option=com_phocamaps&amp;view=phocamapsgmap&amp;tmpl=component&amp;field='.$this->id. $suffix;
// Load the modal behavior script.
//HTMLHelper::_('behavior.modal', 'a.modal_'.$this->id);
}
HTMLHelper::_('jquery.framework');
// Initialize JavaScript field attributes.
$onchange = (string) $this->element['onchange'];
$onchangeOutput = ' onChange="'.(string) $this->element['onchange'].'"';
$idA = 'pgselectmap';
// Build the script.
$script = array();
$script[] = ' function phocaSelectMap_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = title;';
$script[] = ' '.$onchange;
// BE AWARE don't close the window here, we are waiting for close button, not immediately closing
//$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
//$script[] = ' SqueezeBox.close();';
$script[] = ' }';
// Hide Info box on start
if ($this->id == 'jform_latitude') {
$script[] = ' jQuery(document).ready(function() {';
$script[] = ' jQuery(\'#'.$idA.'\').on(\'shown.bs.modal\', function () {';
$script[] = ' jQuery(\'#phmPopupInfo\').html(\'\');';
$script[] = ' })';
$script[] = ' })';
}
// Add the script to the document head.
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
if ($this->id == 'jform_latitude') {
/*$html[] = '<div class="input-append">';
$html[] = '<input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' .
' '.$class.$size.$disabled.$readonly.$onchangeOutput.$maxLength.' />';
$html[] = '<a class="modal_'.$this->id.' btn" title="'.Text::_('COM_PHOCAMAPS_FORM_SELECT_COORDINATES').'"'
.' href="'.($this->element['readonly'] ? '' : $link).'"'
.' rel="{handler: \'iframe\', size: {x: 780, y: 580}}">'
. Text::_('COM_PHOCAMAPS_FORM_SELECT_COORDINATES').'</a>';
$html[] = '</div>'. "\n";*/
$html[] = '<div class="input-append input-group">';
$html[] = '<span class="input-append input-group"><input type="text" id="' . $this->id . '_id" name="' . $this->name . '"'
. ' value="' . $this->value . '" '.$class.$size.$disabled.$readonly.$onchangeOutput.$maxLength.' />';
$html[] = '<a href="'.$link.'" role="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#'.$idA.'" title="' . Text::_('COM_PHOCAMAPS_FORM_SELECT_COORDINATES') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAMAPS_FORM_SELECT_COORDINATES') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAMAPS_FORM_SELECT_COORDINATES'),
'width' => '',
'height' => '',
'modalWidth' => '80',
'bodyHeight' => '80',
'footer' => '<div id="phmPopupInfo" class="ph-info-modal"></div><button type="button" class="btn" data-bs-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAMAPS_CLOSE') . '</button>'
)
);
} else {
$html[] = '<div class="fltlft">';
$html[] = ' <input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' .
' '.$class.$size.$disabled.$readonly.$onchangeOutput.$maxLength.' />';
$html[] = '</div>'. "\n";
}
return implode("\n", $html);
}
}

View File

@ -0,0 +1,57 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
jimport('joomla.form.formfield');
class JFormFieldPhocaTextWarning extends FormField
{
protected $type = 'PhocaTextWarning';
protected function getInput() {
// Initialize some field attributes.
$warning = ( (string)$this->element['warningtext'] ? $this->element['warningtext'] : '' );
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
$value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
$html ='<input type="text" name="'.$this->name.'" id="'.$this->id.'" value="'.$value.'"'
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/>';
if ($warning != '') {
//$html .= '<div style="margin-left:10px;">'.HtmlHelper::_('image', 'administrator/components/com_phocamaps/assets/images/icon-16-warning.png', '' ) . '</div><div>' . JText::_($warning).'</div>';
$html .='<div style="position:relative;float:left;width:auto;margin-left:10px">'.HTMLHelper::_('image', 'administrator/components/com_phocamaps/assets/images/icon-16-warning.png', '',array('style' => 'margin:0;padding:0;margin-right:5px;') ).' '.Text::_($warning).'</div><div style="clear:both"></div>';
}
return $html;
}
protected function getLabel() {
echo '<div class="clearfix"></div>';
return parent::getLabel();
echo '<div class="clearfix"></div>';
}
}
?>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAMAPS_SEARCH" description="COM_PHOCAMAPS_SEARCH" hint="JSEARCH_FILTER" />
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAMAPS_PUBLISHED</option>
<option value="0">COM_PHOCAMAPS_UNPUBLISHED</option>
</field>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAMAPS_LIST_FULL_ORDERING" description="COM_PHOCAMAPS_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
<option value="a.published ASC" >COM_PHOCAMAPS_PUBLISHED_ASC</option>
<option value="a.published DESC" >COM_PHOCAMAPS_PUBLISHED_DESC</option>
<option value="a.url ASC">COM_PHOCAMAPS_URL_ASC</option>
<option value="a.url DESC">COM_PHOCAMAPS_URL_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAMAPS_LIST_LIMIT" description="COM_PHOCAMAPS_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAMAPS_SEARCH" description="COM_PHOCAMAPS_SEARCH" hint="JSEARCH_FILTER" />
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAMAPS_PUBLISHED</option>
<option value="0">COM_PHOCAMAPS_UNPUBLISHED</option>
</field>
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAMAPS_LIST_FULL_ORDERING" description="COM_PHOCAMAPS_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
<option value="a.published ASC" >COM_PHOCAMAPS_PUBLISHED_ASC</option>
<option value="a.published DESC" >COM_PHOCAMAPS_PUBLISHED_DESC</option>
<option value="a.language ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="a.language DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAMAPS_LIST_LIMIT" description="COM_PHOCAMAPS_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
<fields name="filter">
<field name="search" type="text" inputmode="search" label="COM_PHOCAMAPS_SEARCH" description="COM_PHOCAMAPS_SEARCH" hint="JSEARCH_FILTER" />
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="1">COM_PHOCAMAPS_PUBLISHED</option>
<option value="0">COM_PHOCAMAPS_UNPUBLISHED</option>
</field>
<field name="map_id" type="PhocaMapsMap" label="COM_PHOCAMAPS_FILTER_MAP_LABEL" description="COM_PHOCAMAPS_FILTER_MAP_DESC" onchange="this.form.submit();" />
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field name="fullordering" type="list" label="COM_PHOCAMAPS_LIST_FULL_ORDERING" description="COM_PHOCAMAPS_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
<option value="a.catid ASC" >COM_PHOCAMAPS_MAP_ASC</option>
<option value="a.catid DESC" >COM_PHOCAMAPS_MAP_DESC</option>
<option value="a.published ASC" >COM_PHOCAMAPS_PUBLISHED_ASC</option>
<option value="a.published DESC" >COM_PHOCAMAPS_PUBLISHED_DESC</option>
<option value="a.language ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="a.language DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field name="limit" type="limitbox" label="COM_PHOCAMAPS_LIST_LIMIT" description="COM_PHOCAMAPS_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
</fields>
</fieldset>
</form>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_TITLE_LABEL" description="COM_PHOCAMAPS_FIELD_TITLE_DESC" required="true" />
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_ALIAS_LABEL" description="COM_PHOCAMAPS_FIELD_ALIAS_DESC" />
<field name="url" type="text" class="form-control" size="120" label="COM_PHOCAMAPS_FIELD_URL_LABEL" description="COM_PHOCAMAPS_FIELD_URL_DESC" />
<field name="object" type="text" class="form-control" size="60" label="COM_PHOCAMAPS_FIELD_ICON_OBJECT_LABEL" description="COM_PHOCAMAPS_FIELD_ICON_OBJECT_DESC" />
<field name="urls" type="text" class="form-control" size="120" label="COM_PHOCAMAPS_FIELD_URL_SHADOW_LABEL" description="COM_PHOCAMAPS_FIELD_URL_SHADOW_DESC" />
<field name="objects" type="text" class="form-control" size="60" label="COM_PHOCAMAPS_FIELD_ICON_OBJECT_SHADOW_LABEL" description="COM_PHOCAMAPS_FIELD_ICON_OBJECT_SHADOW_DESC" />
<field name="objectshape" type="text" class="form-control" size="60" label="COM_PHOCAMAPS_FIELD_ICON_OBJECT_SHAPE_LABEL" description="COM_PHOCAMAPS_FIELD_ICON_OBJECT_SHAPE_DESC" />
<field name="ordering" type="PhocaMapsOrdering" table="icon" class="form-select" label="COM_PHOCAMAPS_FIELD_ORDERING_LABEL" description="COM_PHOCAMAPS_FIELD_ORDERING_DESC" />
</fieldset>
<fieldset name="publish" label="COM_PHOCAMAPS_GROUP_LABEL_PUBLISHING_DETAILS" >
<field name="published" type="list" label="COM_PHOCAMAPS_FIELD_PUBLISHED_LABEL" description="COM_PHOCAMAPS_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
</field>
</fieldset>
</form>

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_TITLE_LABEL" description="COM_PHOCAMAPS_FIELD_TITLE_DESC" required="true" />
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_ALIAS_LABEL" description="COM_PHOCAMAPS_FIELD_ALIAS_DESC" />
<field name="latitude" type="phocaselectmap" maptype="map" label="COM_PHOCAMAPS_FIELD_LATITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_LATITUDE_DESC" class="form-control" size="40" />
<field name="longitude" type="phocaselectmap" maptype="map" label="COM_PHOCAMAPS_FIELD_LONGITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_LONGITUDE_DESC" class="form-control" size="40" />
<field name="zoom" type="phocaselectmap" maptype="map" label="COM_PHOCAMAPS_FIELD_ZOOM_LABEL" description="COM_PHOCAMAPS_FIELD_ZOOM_DESC" class="form-control" size="40" />
<field name="width" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_MAP_WIDTH_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_WIDTH_DESC" />
<field name="height" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_MAP_HEIGHT_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_HEIGHT_DESC" />
<field name="lang" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_MAP_LANG_NAME_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_LANG_NAME_DESC" />
<field name="ordering" type="PhocaMapsOrdering" table="map" class="form-select" label="COM_PHOCAMAPS_FIELD_ORDERING_LABEL" description="COM_PHOCAMAPS_FIELD_ORDERING_DESC" />
<field name="description" type="editor" buttons="true" hide="pagebreak,readmore" class="form-control" label="COM_PHOCAMAPS_FIELD_DESC_LABEL" description="COM_PHOCAMAPS_FIELD_DESC_DESC" filter="\Joomla\CMS\Component\ComponentHelper::filterText" />
<field name="border" type="list" label="COM_PHOCAMAPS_FIELD_BORDER_LABEL" description="COM_PHOCAMAPS_FIELD_BORDER_DESC" class="form-select" size="1" default="1" typedesign="1" >
<option value="0">COM_PHOCAMAPS_NONE</option>
<option value="1">COM_PHOCAMAPS_GREY</option>
<option value="2">COM_PHOCAMAPS_GREYWB</option>
<option value="3">COM_PHOCAMAPS_GREYRC</option>
<option value="4">COM_PHOCAMAPS_BLACK</option>
</field>
<field name="typeid" type="list" label="COM_PHOCAMAPS_FIELD_MAP_TYPE_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_TYPE_DESC" class="form-select" size="1" default="0" >
<option value="0">COM_PHOCAMAPS_ROADMAP</option>
<option value="1">COM_PHOCAMAPS_SATELLITE</option>
<option value="2">COM_PHOCAMAPS_HYBRID</option>
<option value="3">COM_PHOCAMAPS_TERRAIN</option>
</field>
<field name="typecontrol" type="list" label="COM_PHOCAMAPS_FIELD_MAP_TYPE_CONTROL_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_TYPE_CONTROL_DESC" class="form-select" size="1" default="1" >
<option value="0">COM_PHOCAMAPS_DISABLE</option>
<option value="1">COM_PHOCAMAPS_default</option>
<option value="2">COM_PHOCAMAPS_HORIZONTAL_BAR</option>
<option value="3">COM_PHOCAMAPS_DROPDOWN_MENU</option>
</field>
<field name="typecontrolposition" type="list" label="COM_PHOCAMAPS_FIELD_MAP_TYPE_CONTROL_POS_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_TYPE_CONTROL_POS_DESC" class="form-select" size="1" default="1" >
<option value="1">COM_PHOCAMAPS_TOP</option>
<option value="2">COM_PHOCAMAPS_TOP_LEFT</option>
<option value="3">COM_PHOCAMAPS_TOP_RIGHT</option>
<option value="4">COM_PHOCAMAPS_BOTTOM</option>
<option value="5">COM_PHOCAMAPS_BOTTOM_LEFT</option>
<option value="6">COM_PHOCAMAPS_BOTTOM_RIGHT</option>
<option value="7">COM_PHOCAMAPS_LEFT</option>
<option value="8">COM_PHOCAMAPS_RIGHT</option>
</field>
<field name="doubleclickzoom" type="list" label="COM_PHOCAMAPS_FIELD_DOUBLECLICK_ZOOM_LABEL" description="COM_PHOCAMAPS_FIELD_DOUBLECLICK_ZOOM_DESC" class="form-select" size="1" default="1" >
<option value="0">COM_PHOCAMAPS_NO</option>
<option value="1">COM_PHOCAMAPS_YES</option>
</field>
<field name="scrollwheelzoom" type="list" label="COM_PHOCAMAPS_FIELD_SCROLL_WHEEL_ZOOM_LABEL" description="COM_PHOCAMAPS_FIELD_SCROLL_WHEEL_ZOOM_DESC" class="form-select" size="1" default="1" >
<option value="0">COM_PHOCAMAPS_NO</option>
<option value="1">COM_PHOCAMAPS_YES</option>
</field>
<field name="gesturehandling" type="list" label="COM_PHOCAMAPS_FIELD_GESTURE_HANDLING_LABEL" description="COM_PHOCAMAPS_FIELD_GESTURE_HANDLING_DESC" class="form-select" size="1" default="" >
<option value="">COM_PHOCAMAPS_DISABLED</option>
<option value="cooperative">COM_PHOCAMAPS_COOPERATIVE</option>
</field>
<field name="zoomcontrol" type="list" label="COM_PHOCAMAPS_FIELD_NAVIGATION_CONTROL_LABEL" description="COM_PHOCAMAPS_FIELD_NAVIGATION_CONTROL_DESC" class="form-select" size="1" default="1" >
<option value="0">COM_PHOCAMAPS_DISABLE</option>
<option value="1">COM_PHOCAMAPS_DEFAULT</option>
<option value="2">COM_PHOCAMAPS_MINI_ZOOM</option>
<option value="3">COM_PHOCAMAPS_ZOOM_PAN</option>
<option value="4">COM_PHOCAMAPS_ANDROID</option>
</field>
<field name="scalecontrol" type="list" label="COM_PHOCAMAPS_FIELD_SCALE_CONTROL_LABEL" description="COM_PHOCAMAPS_FIELD_SCALE_CONTROL_DESC" class="form-select" size="1" default="1" >
<option value="0">COM_PHOCAMAPS_DISABLE</option>
<option value="1">COM_PHOCAMAPS_ENABLE</option>
</field>
<field name="autolocation" type="list" default="0" label="COM_PHOCAMAPS_DISPLAY_CURRENT_LOCATION_LABEL" description="COM_PHOCAMAPS_DISPLAY_CURRENT_LOCATION_DESC">
<option value="0">COM_PHOCAMAPS_NO</option>
<option value="1">COM_PHOCAMAPS_YES</option>
</field>
<field name="displayroute" type="list" label="COM_PHOCAMAPS_FIELD_DISPLAY_ROUTE_LABEL" description="COM_PHOCAMAPS_FIELD_DISPLAY_ROUTE_DESC" class="form-select" size="1" default="1" >
<option value="0">COM_PHOCAMAPS_NO</option>
<option value="1">COM_PHOCAMAPS_YES</option>
</field>
<field name="kmlfile" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_KML_FILE_LABEL" description="COM_PHOCAMAPS_KML_FILE_DESC" />
<field name="custom_options" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_CUSTOM_OPTIONS_LABEL" description="COM_PHOCAMAPS_CUSTOM_OPTIONS_DESC" />
<field name="map_styles" type="textarea" class="form-control" rows="5" label="COM_PHOCAMAPS_MAP_STYLES_LABEL" description="COM_PHOCAMAPS_MAP_STYLES_DESC" />
<field name="trackfiles_osm" type="textarea" class="form-control" rows="5" label="COM_PHOCAMAPS_FIELD_OSM_TRACK_LOG_FILES_LABEL" description="COM_PHOCAMAPS_FIELD_OSM_TRACK_LOG_FILES_DESC" />
<field name="trackcolors_osm" type="textarea" class="form-control" rows="5" label="COM_PHOCAMAPS_FIELD_OSM_COLORS_FOR_TRACKS_LABEL" description="COM_PHOCAMAPS_FIELD_OSM_COLORS_FOR_TRACKS_DESC" />
<field name="fitbounds_osm" type="list" label="COM_PHOCAMAPS_FIELD_OSM_FIT_MAP_TO_FIRST_TRACK_LABEL" description="COM_PHOCAMAPS_FIELD_OSM_FIT_MAP_TO_FIRST_TRACK_DESC" >
<option value="0">COM_PHOCAMAPS_NO</option>
<option value="1">COM_PHOCAMAPS_YES</option>
</field>
</fieldset>
<fieldset name="publish" label="COM_PHOCAMAPS_GROUP_LABEL_PUBLISHING_DETAILS" >
<field name="published" type="list" label="COM_PHOCAMAPS_FIELD_PUBLISHED_LABEL" description="COM_PHOCAMAPS_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
</field>
<field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL" description="COM_PHOCAMAPS_FIELD_LANGUAGE_MAP_DESC" class="form-select">
<option value="*">JALL</option>
</field>
</fieldset>
</form>

View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_TITLE_LABEL" description="COM_PHOCAMAPS_FIELD_TITLE_DESC" required="true" />
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_ALIAS_LABEL" description="COM_PHOCAMAPS_FIELD_ALIAS_DESC" />
<field name="latitude" type="phocaselectmap" maptype="marker" label="COM_PHOCAMAPS_FIELD_LATITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_LATITUDE_DESC" class="form-control" size="40" onchange="setPMGPSLatitudeJForm(this.value);" />
<field name="longitude" type="phocaselectmap" maptype="marker" label="COM_PHOCAMAPS_FIELD_LONGITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_LONGITUDE_DESC" class="form-control" size="40" onchange="setPMGPSLongitudeJForm(this.value);" />
<field name="gpslatitude" type="phocaselectmap" class="form-control pmreadonly" size="40" label="COM_PHOCAMAPS_FIELD_GPS_LATITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_GPS_LATITUDE_DESC" readonly="true" />
<field name="gpslongitude" type="phocaselectmap" class="form-control pmreadonly" size="40" label="COM_PHOCAMAPS_FIELD_GPS_LONGITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_GPS_LONGITUDE_DESC" readonly="true" />
<field name="catid" type="phocamapsmap" default="" label="COM_PHOCAMAPS_FIELD_SELECT_MAP_LABEL" description="COM_PHOCAMAPS_FIELD_SELECT_MAP_LABEL" required="true" class="form-select" />
<!--
<field name="markerwindow" type="list" label="COM_PHOCAMAPS_FIELD_OPEN_MARKER_WINDOW_LABEL" description="COM_PHOCAMAPS_FIELD_OPEN_MARKER_WINDOW_DESC" class="form-control" size="1" default="0" >
<option value="0">COM_PHOCAMAPS_NO</option>
<option value="1">COM_PHOCAMAPS_YES</option>
</field>-->
<field name="markerwindow" type="list" label="COM_PHOCAMAPS_FIELD_MARKER_WINDOW_LABEL" description="COM_PHOCAMAPS_FIELD_MARKER_WINDOW_DESC" class="form-select" size="1" default="0" >
<option value="0">COM_PHOCAMAPS_CLOSED</option>
<option value="1">COM_PHOCAMAPS_OPENED</option>
<option value="2">COM_PHOCAMAPS_HIDDEN</option>
</field>
<field name="contentwidth" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_MARKER_CONTENT_WIDTH_LABEL" description="COM_PHOCAMAPS_MARKER_CONTENT_WIDTH_DESC" />
<field name="contentheight" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_MARKER_CONTENT_HEIGHT_LABEL" description="COM_PHOCAMAPS_MARKER_CONTENT_HEIGHT_DESC" />
<field name="displaygps" type="list" label="COM_PHOCAMAPS_FIELD_DISPLAY_GPS_LABEL" description="COM_PHOCAMAPS_FIELD_DISPLAY_GPS_DESC" class="form-select" size="1" default="0" >
<option value="0">COM_PHOCAMAPS_NO</option>
<option value="1">COM_PHOCAMAPS_YES</option>
</field>
<field name="ordering" type="PhocaMapsOrdering" table="map" class="form-select" label="COM_PHOCAMAPS_FIELD_ORDERING_LABEL" description="COM_PHOCAMAPS_FIELD_ORDERING_DESC" />
<field name="description" type="editor" buttons="true" hide="pagebreak,readmore" class="form-control" label="COM_PHOCAMAPS_FIELD_DESC_LABEL" description="COM_PHOCAMAPS_FIELD_DESC_DESC" filter="\Joomla\CMS\Component\ComponentHelper::filterText" />
<field name="icon" type="phocamapsradio" label="COM_PHOCAMAPS_FIELD_MARKER_ICON_LABEL" description="COM_PHOCAMAPS_FIELD_MARKER_ICON_DESC" class="form-control" size="1" default="0" typedesign="2" >
<option value="0">COM_PHOCAMAPS_DEFAULT</option>
<option value="1">COM_PHOCAMAPS_IGREY</option>
<option value="2">COM_PHOCAMAPS_IYELLOW</option>
<option value="3">COM_PHOCAMAPS_IHOME</option>
<option value="4">COM_PHOCAMAPS_IGREEN</option>
<option value="5">COM_PHOCAMAPS_ISTAR</option>
<option value="6">COM_PHOCAMAPS_IINFOH</option>
<option value="7">COM_PHOCAMAPS_IINFOI</option>
<option value="8">COM_PHOCAMAPS_IINFOP</option>
<option value="9">COM_PHOCAMAPS_IINFOPH</option>
<option value="10">COM_PHOCAMAPS_IINFOZ</option>
</field>
<field name="iconext" type="phocaselecticon" label="COM_PHOCAMAPS_FIELD_MARKER_ICON_EXT_LABEL" description="COM_PHOCAMAPS_FIELD_MARKER_ICON_EXT_DESC" class="form-select" size="1" default="0" />
<field name="osm_icon" type="text" default="circle" class="form-control" size="40" label="COM_PHOCAMAPS_MARKER_ICON_OSM_LABEL" description="COM_PHOCAMAPS_MARKER_ICON_OSM_DESC" />
<field name="osm_marker_color" type="list" label="COM_PHOCAMAPS_FIELD_MARKER_COLOR_OSM_LABEL" description="COM_PHOCAMAPS_FIELD_MARKER_COLOR_OSM_DESC" class="form-select" size="1" default="blue" >
<option value="red">red</option>
<option value="darkred">darkred</option>
<option value="orange">orange</option>
<option value="green">green</option>
<option value="darkgreen">darkgreen</option>
<option value="blue">blue</option>
<option value="purple">purple</option>
<option value="darkpurple">darkpurple</option>
<option value="cadetblue">cadetblue</option>
</field>
<field name="osm_icon_color" type="text" default="#ffffff" class="form-control" size="40" label="COM_PHOCAMAPS_ICON_COLOR_OSM_LABEL" description="COM_PHOCAMAPS_ICON_COLOR_OSM_DESC" />
<field name="osm_icon_prefix" type="text" default="fa" class="form-control" size="40" label="COM_PHOCAMAPS_ICON_PREFIX_OSM_LABEL" description="COM_PHOCAMAPS_ICON_PREFIX_OSM_DESC" />
<field name="osm_icon_spin" type="list" label="COM_PHOCAMAPS_FIELD_ICON_SPIN_OSM_LABEL" description="COM_PHOCAMAPS_FIELD_ICON_SPIN_OSM_DESC" class="form-select" size="1" default="0" >
<option value="0">COM_PHOCAMAPS_NO</option>
<option value="1">COM_PHOCAMAPS_YES</option>
</field>
<field name="osm_icon_class" type="textarea" default="" class="form-control" size="40" label="COM_PHOCAMAPS_ICON_CLASS_OSM_LABEL" description="COM_PHOCAMAPS_ICON_CLASS_OSM_DESC" />
</fieldset>
<fieldset name="publish" label="COM_PHOCAMAPS_GROUP_LABEL_PUBLISHING_DETAILS" >
<field name="published" type="list" label="COM_PHOCAMAPS_FIELD_PUBLISHED_LABEL" description="COM_PHOCAMAPS_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
</field>
<field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL" description="COM_PHOCAMAPS_FIELD_LANGUAGE_MARKER_DESC" class="form-select">
<option value="*">JALL</option>
</field>
</fieldset>
</form>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,84 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined( '_JEXEC' ) or die();
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Factory;
jimport('joomla.application.component.modeladmin');
class PhocaMapsCpModelPhocaMapsIcon extends AdminModel
{
protected $option = 'com_phocamaps';
protected $text_prefix = 'com_phocamaps';
protected function canDelete($record) {
return parent::canDelete($record);
}
protected function canEditState($record) {
return parent::canEditState($record);
}
public function getTable($type = 'PhocamapsIcon', $prefix = 'Table', $config = array()){
return Table::getInstance($type, $prefix, $config);
}
public function getForm($data = array(), $loadData = true) {
$app = Factory::getApplication();
$form = $this->loadForm('com_phocamaps.phocamapsicon', 'phocamapsicon', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
protected function loadFormData() {
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState('com_phocamaps.edit.phocamapsicon.data', array());
if (empty($data)) {
$data = $this->getItem();
}
return $data;
}
protected function prepareTable($table) {
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias = ApplicationHelper::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias = ApplicationHelper::stringURLSafe($table->title);
}
if (empty($table->id)) {
// Set the values
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocamaps_icon');
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
}
}
}
?>

View File

@ -0,0 +1,152 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined( '_JEXEC' ) or die();
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.application.component.modellist');
class PhocaMapsCpModelPhocaMapsIcons extends ListModel
{
protected $option = 'com_phocamaps';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'alias', 'a.alias',
'url','a.url',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'state', 'a.state',
'access', 'a.access', 'access_level',
'ordering', 'a.ordering',
'language', 'a.language',
//'hits', 'a.hits',
'published','a.published'
);
}
parent::__construct($config);
}
protected function populateState($ordering = NULL, $direction = NULL)
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/* $accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);*/
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Load the parameters.
$params = ComponentHelper::getParams('com_phocamaps');
$this->setState('params', $params);
// List state information.
parent::populateState('a.title', 'asc');
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
//$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.icon_id');
return parent::getStoreId($id);
}
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('`#__phocamaps_icon` AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
// Filter by access level.
/* if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}*/
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( a.title LIKE '.$search.' OR a.alias LIKE '.$search.')');
}
}
// Add the list ordering clause.
//$orderCol = $this->state->get('list.ordering');
//$orderDirn = $this->state->get('list.direction');
$orderCol = $this->state->get('list.ordering', 'title');
$orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != 'a.ordering') {
$orderCol = 'a.ordering';
}
$query->order($db->escape($orderCol.' '.$orderDirn));
//echo nl2br(str_replace('#__', 'jos_', $query->__toString()));
return $query;
}
}
?>

View File

@ -0,0 +1,399 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined( '_JEXEC' ) or die();
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\Utilities\ArrayHelper;
jimport('joomla.application.component.modeladmin');
use Joomla\String\StringHelper;
class PhocaMapsCpModelPhocaMapsMap extends AdminModel
{
protected $option = 'com_phocamaps';
protected $text_prefix = 'com_phocamaps';
protected function canDelete($record)
{
//$user = JFactory::getUser();
return parent::canDelete($record);
}
protected function canEditState($record)
{
//$user = JFactory::getUser();
return parent::canEditState($record);
}
public function getTable($type = 'PhocamapsMap', $prefix = 'Table', $config = array())
{
return Table::getInstance($type, $prefix, $config);
}
public function getForm($data = array(), $loadData = true) {
$app = Factory::getApplication();
$form = $this->loadForm('com_phocamaps.phocamapsmap', 'phocamapsmap', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState('com_phocamaps.edit.phocamapsmap.data', array());
if (empty($data)) {
$data = $this->getItem();
}
return $data;
}
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias = ApplicationHelper::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias = ApplicationHelper::stringURLSafe($table->title);
}
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocamaps_map');
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
protected function getReorderConditions($table = null)
{
$condition = array();
//$condition[] = 'parent_id = '. (int) $table->parent_id;
//$condition[] = 'state >= 0';
return $condition;
}
protected function batchCopy($value, $pks, $contexts)
{
$categoryId = (int) $value;
$app = Factory::getApplication();
$table = $this->getTable();
$db = $this->getDbo();
$i = 0;
// Check that the category exists
if ($categoryId) {
$categoryTable = Table::getInstance('PhocaMapsMap', 'Table');
if (!$categoryTable->load($categoryId)) {
if ($error = $categoryTable->getError()) {
// Fatal error
throw new Exception($error, 500);
return false;
}
else {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
return false;
}
}
}
//if (empty($categoryId)) {
if (!isset($categoryId)) {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
return false;
}
// Check that the user has create permission for the component
$extension = Factory::getApplication()->input->getCmd('option');
$user = Factory::getUser();
if (!$user->authorise('core.create', $extension)) {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'), 500);
return false;
}
// Parent exists so we let's proceed
while (!empty($pks))
{
// Pop the first ID off the stack
$pk = array_shift($pks);
$table->reset();
// Check that the row actually exists
if (!$table->load($pk)) {
if ($error = $table->getError()) {
// Fatal error
throw new Exception($error, 500);
return false;
}
else {
// Not fatal error
$app->enqueueMessage(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// Alter the title & alias
$data = $this->generateNewTitle($categoryId, $table->alias, $table->title);
$table->title = $data['0'];
$table->alias = $data['1'];
// Reset the ID because we are making a copy
$table->id = 0;
// New category ID
//$table->parent_id = $categoryId;
// Ordering
$table->ordering = $this->increaseOrdering($categoryId);
$table->hits = 0;
// Check the row.
if (!$table->check()) {
throw new Exception($table->getError(), 500);
return false;
}
// Store the row.
if (!$table->store()) {
throw new Exception($table->getError(), 500);
return false;
}
// Get the new item ID
$newId = $table->get('id');
// Add the new ID to the array
$newIds[$pk] = $newId;
$i++;
}
// Clean the cache
$this->cleanCache();
return $newIds;
}
protected function batchMove($value, $pks, $contexts)
{
$categoryId = (int) $value;
$app = Factory::getApplication();
$table = $this->getTable();
//$db = $this->getDbo();
// Check that the category exists
if ($categoryId) {
$categoryTable = Table::getInstance('PhocaMapsMap', 'Table');
if (!$categoryTable->load($categoryId)) {
if ($error = $categoryTable->getError()) {
// Fatal error
throw new Exception($error, 500);
return false;
}
else {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
return false;
}
}
}
//if (empty($categoryId)) {
if (!isset($categoryId)) {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
return false;
}
// Check that user has create and edit permission for the component
$extension = Factory::getApplication()->input->getCmd('option');
$user = Factory::getUser();
if (!$user->authorise('core.create', $extension)) {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'), 500);
return false;
}
if (!$user->authorise('core.edit', $extension)) {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'), 500);
return false;
}
// Parent exists so we let's proceed
foreach ($pks as $pk)
{
// Check that the row actually exists
if (!$table->load($pk)) {
if ($error = $table->getError()) {
// Fatal error
throw new Exception($error, 500);
return false;
}
else {
// Not fatal error
$app->enqueueMessage(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk), 'error');
continue;
}
}
// Set the new category ID
//$table->parent_id = $categoryId;
// Check the row.
if (!$table->check()) {
throw new Exception($table->getError(), 500);
return false;
}
// Store the row.
if (!$table->store()) {
throw new Exception($table->getError(), 500);
return false;
}
}
// Clean the cache
$this->cleanCache();
return true;
}
public function increaseOrdering($categoryId) {
$ordering = 1;
$this->_db->setQuery('SELECT MAX(ordering) FROM #__phocamaps_map');
$max = $this->_db->loadResult();
$ordering = $max + 1;
return $ordering;
}
public function batch($commands, $pks, $contexts)
{
// Sanitize user ids.
$pks = array_unique($pks);
ArrayHelper::toInteger($pks);
// Remove any values of zero.
if (array_search(0, $pks, true)) {
unset($pks[array_search(0, $pks, true)]);
}
if (empty($pks)) {
throw new Exception(Text::_('JGLOBAL_NO_ITEM_SELECTED'), 500);
return false;
}
$done = false;
if (!empty($commands['assetgroup_id'])) {
if (!$this->batchAccess($commands['assetgroup_id'], $pks)) {
return false;
}
$done = true;
}
//PHOCAEDIT - because parent it is 0
//if (!empty($commands['category_id'])) {
if (isset($commands['category_id']))
{
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c')
{
$result = $this->batchCopy($commands['category_id'], $pks, $contexts);
if (is_array($result))
{
$pks = $result;
}
else
{
return false;
}
}
elseif ($cmd == 'm' && !$this->batchMove($commands['category_id'], $pks, $contexts))
{
return false;
}
$done = true;
}
if (!empty($commands['language_id']))
{
if (!$this->batchLanguage($commands['language_id'], $pks, $contexts))
{
return false;
}
$done = true;
}
if (!$done) {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'), 500);
return false;
}
// Clear the cache
$this->cleanCache();
return true;
}
protected function generateNewTitle($category_id, $alias, $title)
{
// Alter the title & alias
$table = $this->getTable();
while ($table->load(array('alias' => $alias)))
{
$title = StringHelper::increment($title);
$alias = StringHelper::increment($alias, 'dash');
// Joomla! 3.5
//$title = StringHelper::increment($title);
//$alias = StringHelper::increment($alias, 'dash');
}
return array($title, $alias);
}
}
?>

View File

@ -0,0 +1,162 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined( '_JEXEC' ) or die();
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.application.component.modellist');
class PhocaMapsCpModelPhocaMapsMaps extends ListModel
{
protected $option = 'com_phocamaps';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'state', 'a.state',
'access', 'a.access', 'access_level',
'ordering', 'a.ordering',
'language', 'a.language',
'hits', 'a.hits',
'published','a.published'
);
}
parent::__construct($config);
}
protected function populateState($ordering = NULL, $direction = NULL)
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/* $accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);*/
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Load the parameters.
$params = ComponentHelper::getParams('com_phocamaps');
$this->setState('params', $params);
// List state information.
parent::populateState($ordering, $direction);
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
//$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.map_id');
return parent::getStoreId($id);
}
protected function getListQuery()
{
/*
$query = 'SELECT a.*, u.name AS editor '
.' FROM #__phocamaps_map AS a '
.' LEFT JOIN #__users AS u ON u.id = a.checked_out '
. $where
. $orderby;
*/
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('`#__phocamaps_map` AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
// Filter by access level.
/* if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}*/
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( a.title LIKE '.$search.' OR a.alias LIKE '.$search.')');
}
}
// Filter on the language.
if ($language = $this->getState('filter.language')) {
$query->where('a.language = ' . $db->quote($language));
}
// Add the list ordering clause.
//$orderCol = $this->state->get('list.ordering');
//$orderDirn = $this->state->get('list.direction');
$orderCol = $this->state->get('list.ordering', 'title');
$orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != 'a.ordering') {
$orderCol = 'a.ordering';
}
$query->order($db->escape($orderCol.' '.$orderDirn));
//echo nl2br(str_replace('#__', 'jos_', $query->__toString()));
return $query;
}
}
?>

View File

@ -0,0 +1,303 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined( '_JEXEC' ) or die();
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Factory;
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Language\Text;
jimport('joomla.application.component.modeladmin');
class PhocaMapsCpModelPhocaMapsMarker extends AdminModel
{
protected $option = 'com_phocamaps';
protected $text_prefix = 'com_phocamaps';
protected function canDelete($record)
{
//$user = JFactory::getUser();
return parent::canDelete($record);
}
protected function canEditState($record)
{
//$user = JFactory::getUser();
return parent::canEditState($record);
}
public function getTable($type = 'PhocaMapsMarker', $prefix = 'Table', $config = array())
{
return Table::getInstance($type, $prefix, $config);
}
public function getForm($data = array(), $loadData = true) {
$app = Factory::getApplication();
$form = $this->loadForm('com_phocamaps.phocamapsmarker', 'phocamapsmarker', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState('com_phocamaps.edit.phocamapsmarker.data', array());
if (empty($data)) {
$data = $this->getItem();
}
return $data;
}
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = Factory::getDate();
$user = Factory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias = ApplicationHelper::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias = ApplicationHelper::stringURLSafe($table->title);
}
if (empty($table->id)) {
// Set the values
//$table->created = $date->toSql();
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$db = Factory::getDbo();
$db->setQuery('SELECT MAX(ordering) FROM #__phocamaps_marker WHERE catid='.(int)$table->catid);
$max = $db->loadResult();
$table->ordering = $max+1;
}
}
else {
// Set the values
//$table->modified = $date->toSql();
//$table->modified_by = $user->get('id');
}
}
protected function getReorderConditions($table = null)
{
$condition = array();
$condition[] = 'catid = '.(int) $table->catid;
return $condition;
}
protected function batchCopy($value, $pks, $contexts)
{
$categoryId = (int) $value;
$app = Factory::getApplication();
$table = $this->getTable();
$db = $this->getDbo();
$i = 0;
// Check that the category exists
if ($categoryId) {
$categoryTable = Table::getInstance('PhocaMapsMap', 'Table');
if (!$categoryTable->load($categoryId)) {
if ($error = $categoryTable->getError()) {
// Fatal error
throw new Exception($error, 500);
return false;
}
else {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
return false;
}
}
}
//if (empty($categoryId)) {
if (!isset($categoryId)) {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
return false;
}
// Check that the user has create permission for the component
$extension = Factory::getApplication()->input->getCmd('option');
$user = Factory::getUser();
if (!$user->authorise('core.create', $extension)) {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'), 500);
return false;
}
// Parent exists so we let's proceed
while (!empty($pks))
{
// Pop the first ID off the stack
$pk = array_shift($pks);
$table->reset();
// Check that the row actually exists
if (!$table->load($pk)) {
if ($error = $table->getError()) {
// Fatal error
throw new Exception($error, 500);
return false;
}
else {
// Not fatal error
//throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk), 500);
$app->enqueueMessage(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk), 'error');
continue;
}
}
// Alter the title & alias
$data = $this->generateNewTitle($categoryId, $table->alias, $table->title);
$table->title = $data['0'];
$table->alias = $data['1'];
// Reset the ID because we are making a copy
$table->id = 0;
// Set the new category ID
$table->catid = $categoryId;
// Ordering
$table->ordering = $this->increaseOrdering($categoryId);
$table->hits = 0;
// Check the row.
if (!$table->check()) {
throw new Exception($table->getError(), 500);
return false;
}
// Store the row.
if (!$table->store()) {
throw new Exception($table->getError(), 500);
return false;
}
// Get the new item ID
$newId = $table->get('id');
// Add the new ID to the array
$newIds[$pk] = $newId;
$i++;
}
// Clean the cache
$this->cleanCache();
return $newIds;
}
protected function batchMove($value, $pks, $contexts)
{
$categoryId = (int) $value;
$app = Factory::getApplication();
$table = $this->getTable();
//$db = $this->getDbo();
// Check that the category exists
if ($categoryId) {
$categoryTable = Table::getInstance('PhocaMapsMap', 'Table');
if (!$categoryTable->load($categoryId)) {
if ($error = $categoryTable->getError()) {
// Fatal error
throw new Exception($error, 500);
return false;
}
else {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
return false;
}
}
}
//if (empty($categoryId)) {
if (!isset($categoryId)) {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
return false;
}
// Check that user has create and edit permission for the component
$extension = Factory::getApplication()->input->getCmd('option');
$user = Factory::getUser();
if (!$user->authorise('core.create', $extension)) {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'), 500);
return false;
}
if (!$user->authorise('core.edit', $extension)) {
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'), 500);
return false;
}
// Parent exists so we let's proceed
foreach ($pks as $pk)
{
// Check that the row actually exists
if (!$table->load($pk)) {
if ($error = $table->getError()) {
// Fatal error
throw new Exception($error, 500);
return false;
}
else {
// Not fatal error
//throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
$app->enqueueMessage(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk), 'error');
continue;
}
}
// Set the new category ID
$table->catid = $categoryId;
// Check the row.
if (!$table->check()) {
throw new Exception($table->getError(), 500);
return false;
}
// Store the row.
if (!$table->store()) {
throw new Exception($table->getError(), 500);
return false;
}
}
// Clean the cache
$this->cleanCache();
return true;
}
public function increaseOrdering($categoryId) {
$ordering = 1;
$this->_db->setQuery('SELECT MAX(ordering) FROM #__phocamaps_marker WHERE catid='.(int)$categoryId);
$max = $this->_db->loadResult();
$ordering = $max + 1;
return $ordering;
}
}
?>

View File

@ -0,0 +1,177 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined( '_JEXEC' ) or die();
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.application.component.modellist');
class PhocaMapsCpModelPhocaMapsMarkers extends ListModel
{
protected $option = 'com_phocamaps';
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'alias', 'a.alias',
'catid', 'a.catid',
'map_id', 'map_id',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'state', 'a.state',
'access', 'a.access', 'access_level',
'ordering', 'a.ordering',
'language', 'a.language',
'hits', 'a.hits',
'published','a.published'
);
}
parent::__construct($config);
}
protected function populateState($ordering = NULL, $direction = NULL)
{
// Initialise variables.
$app = Factory::getApplication('administrator');
// Load the filter state.
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
/* $accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
$this->setState('filter.access', $accessId);*/
$mapId = $app->getUserStateFromRequest($this->context.'.filter.map_id', 'filter_map_id', null, 'int');
$this->setState('filter.map_id', $mapId);
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
$this->setState('filter.published', $state);
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Load the parameters.
$params = ComponentHelper::getParams('com_phocamaps');
$this->setState('params', $params);
// List state information.
parent::populateState('a.title', 'asc');
}
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
//$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.marker_id');
$id .= ':'.$this->getState('filter.map_id');
return parent::getStoreId($id);
}
protected function getListQuery()
{
/*
$query = 'SELECT a.*, u.name AS editor, cc.title AS catidname '
.' FROM #__phocamaps_marker AS a '
.' LEFT JOIN #__phocamaps_map AS cc ON cc.id = a.catid '
.' LEFT JOIN #__users AS u ON u.id = a.checked_out '
. $where
. $orderby;
*/
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
)
);
$query->from('`#__phocamaps_marker` AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
// Filter by access level.
/* if ($access = $this->getState('filter.access')) {
$query->where('a.access = '.(int) $access);
}*/
$query->select('c.title AS map_title, c.id AS map_id');
$query->join('LEFT', '#__phocamaps_map AS c ON c.id = a.catid');
// Filter by published state.
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = '.(int) $published);
}
else if ($published === '') {
$query->where('(a.published IN (0, 1))');
}
// Filter by category.
$mapId = $this->getState('filter.map_id');
if (is_numeric($mapId) && (int)$mapId > 0) {
$query->where('a.catid = ' . (int) $mapId);
}
// Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else
{
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('( a.title LIKE '.$search.' OR a.alias LIKE '.$search.')');
}
}
// Filter on the language.
if ($language = $this->getState('filter.language')) {
$query->where('a.language = ' . $db->quote($language));
}
//$orderCol = $this->state->get('list.ordering');
//$orderDirn = $this->state->get('list.direction');
$orderCol = $this->state->get('list.ordering', 'title');
$orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol == 'a.ordering' || $orderCol == 'map_title') {
$orderCol = 'map_title '.$orderDirn.', a.ordering';
}
$query->order($db->escape($orderCol.' '.$orderDirn));
//echo nl2br(str_replace('#__', 'jos_', $query->__toString()));
return $query;
}
}
?>

View File

@ -0,0 +1,37 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
if (!Factory::getUser()->authorise('core.manage', 'com_phocamaps')) {
throw new Exception(Text::_('COM_PHOCAMAPS_ERROR_ALERTNOAUTHOR'), 404);
return false;
}
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
require_once JPATH_ADMINISTRATOR . '/components/com_phocamaps/libraries/autoloadPhoca.php';
require_once( JPATH_COMPONENT.'/controller.php' );
require_once( JPATH_COMPONENT.'/helpers/phocamaps.php' );
require_once( JPATH_COMPONENT.'/helpers/phocamapsmap.php' );
require_once( JPATH_COMPONENT.'/helpers/phocamapsmaposm.php' );
require_once( JPATH_COMPONENT.'/helpers/phocamapsutils.php' );
require_once( JPATH_COMPONENT.'/helpers/phocamapsrenderadmin.php' );
require_once( JPATH_COMPONENT.'/helpers/renderadminview.php' );
require_once( JPATH_COMPONENT.'/helpers/renderadminviews.php' );
require_once( JPATH_COMPONENT.'/helpers/html/map.php' );
require_once( JPATH_COMPONENT.'/helpers/html/batch.php' );
jimport('joomla.application.component.controller');
$controller = BaseController::getInstance('PhocaMapsCp');
$controller->execute(Factory::getApplication()->input->get('task'));
$controller->redirect();
?>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" method="upgrade" version="5.0">
<name>com_phocamaps</name>
<author>Jan Pavelka (www.phoca.cz)</author>
<creationDate>29/06/2024</creationDate>
<authorEmail></authorEmail>
<authorUrl>https://www.phoca.cz</authorUrl>
<copyright>Jan Pavelka</copyright>
<license>GNU/GPL</license>
<version>5.0.2</version>
<description>COM_PHOCAMAPS_XML_DESCRIPTION</description>
<scriptfile>script.php</scriptfile>
<projectName>PhocaMaps</projectName>
<install>
<sql>
<file driver="mysql" charset="utf8">install/sql/mysql/install.utf8.sql</file>
</sql>
</install>
<uninstall>
<sql>
<file driver="mysql" charset="utf8">install/sql/mysql/uninstall.utf8.sql</file>
</sql>
</uninstall>
<update>
<schemas>
<schemapath type="mysql">update/sql/mysql</schemapath>
</schemas>
</update>
<files folder="site">
<folder>helpers</folder>
<folder>views</folder>
<folder>models</folder>
<filename>index.html</filename>
<filename>router.php</filename>
<filename>controller.php</filename>
<filename>phocamaps.php</filename>
</files>
<media destination="com_phocamaps" folder="media">
<folder>duotone</folder>
<folder>css</folder>
<folder>js</folder>
<folder>images</folder>
<filename>index.html</filename>
</media>
<languages folder="admin/language">
<language tag="en-GB" client="site">en-GB/en-GB.com_phocamaps.ini</language>
<language tag="en-GB" client="site">en-GB/en-GB.com_phocamaps.sys.ini</language>
</languages>
<administration>
<menu img="media/com_phocamaps/images/administrator/icon-16-pmap-menu.png" alt="COM_PHOCAMAPS" link="option=com_phocamaps">COM_PHOCAMAPS</menu>
<submenu>
<menu img="media/com_phocamaps/images/administrator/icon-16-pmap-menu-cp.png" alt="COM_PHOCAMAPS_CONTROLPANEL" view="phocamapscp" link="option=com_phocamaps">COM_PHOCAMAPS_CONTROLPANEL</menu>
<menu img="media/com_phocamaps/images/administrator/icon-16-pmap-menu-map.png" alt="COM_PHOCAMAPS_MAPS" view="phocamapsmaps" link="option=com_phocamaps&amp;view=phocamapsmaps">COM_PHOCAMAPS_MAPS</menu>
<menu img="media/com_phocamaps/images/administrator/icon-16-pmap-menu-marker.png" alt="COM_PHOCAMAPS_MARKERS" view="phocamapsmarkers" link="option=com_phocamaps&amp;view=phocamapsmarkers">COM_PHOCAMAPS_MARKERS</menu>
<menu img="media/com_phocamaps/images/administrator/icon-16-pmap-menu-icon.png" alt="COM_PHOCAMAPS_ICONS" view="phocamapsicons" link="option=com_phocamaps&amp;view=phocamapsicons">COM_PHOCAMAPS_ICONS</menu>
<menu img="media/com_phocamaps/images/administrator/icon-16-pmap-menu-info.png" alt="COM_PHOCAMAPS_INFO" view="phocamapsinfo" link="option=com_phocamaps&amp;view=phocamapsinfo">COM_PHOCAMAPS_INFO</menu>
</submenu>
<files folder="admin">
<folder>libraries</folder>
<folder>controllers</folder>
<folder>install</folder>
<folder>update</folder>
<folder>tables</folder>
<folder>helpers</folder>
<folder>views</folder>
<folder>help</folder>
<folder>assets</folder>
<folder>models</folder>
<filename>index.html</filename>
<filename>config.xml</filename>
<filename>access.xml</filename>
<filename>controller.php</filename>
<filename>phocamaps.php</filename>
</files>
<languages folder="admin/language">
<language tag="en-GB">en-GB/en-GB.com_phocamaps.ini</language>
<language tag="en-GB">en-GB/en-GB.com_phocamaps.sys.ini</language>
</languages>
</administration>
<updateservers>
<server type="extension" name="COM_PHOCAMAPS" priority="1"><![CDATA[https://raw.githubusercontent.com/PhocaCz/PhocaMaps/master/manifest.xml]]></server>
</updateservers>
</extension>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,39 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Table\Table;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Factory;
class TablePhocaMapsIcon extends Table
{
function __construct( &$db ) {
parent::__construct( '#__phocamaps_icon', 'id', $db );
}
function check(){
if (trim( $this->title ) == '') {
throw new Exception( Text::_( 'COM_PHOCAMAPS_ERROR_TITLE_NOT_SET'),500 );
return false;
}
if (empty($this->alias)) {
$this->alias = $this->title;
}
$this->alias = ApplicationHelper::stringURLSafe($this->alias);
if (trim(str_replace('-', '', $this->alias)) == '') {
$this->alias = Factory::getDate()->format("Y-m-d-H-i-s");
}
return true;
}
}
?>

View File

@ -0,0 +1,39 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Table\Table;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Factory;
class TablePhocaMapsMap extends Table
{
function __construct( &$db ) {
parent::__construct( '#__phocamaps_map', 'id', $db );
}
function check(){
if (trim( $this->title ) == '') {
throw new Exception( Text::_( 'COM_PHOCAMAPS_ERROR_TITLE_NOT_SET'),500 );
return false;
}
if (empty($this->alias)) {
$this->alias = $this->title;
}
$this->alias = ApplicationHelper::stringURLSafe($this->alias);
if (trim(str_replace('-', '', $this->alias)) == '') {
$this->alias = Factory::getDate()->format("Y-m-d-H-i-s");
}
return true;
}
}
?>

View File

@ -0,0 +1,44 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Table\Table;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Factory;
class TablePhocaMapsMarker extends Table
{
function __construct( &$db ) {
parent::__construct( '#__phocamaps_marker', 'id', $db );
}
function check(){
if (trim( $this->catid ) == '') {
throw new Exception( Text::_( 'COM_PHOCAMAPS_ERROR_MAP_NOT_SELECTED'), 500 );
return false;
}
if (trim( $this->title ) == '') {
throw new Exception( Text::_( 'COM_PHOCAMAPS_ERROR_TITLE_NOT_SET'), 500 );
return false;
}
if (empty($this->alias)) {
$this->alias = $this->title;
}
$this->alias = ApplicationHelper::stringURLSafe($this->alias);
if (trim(str_replace('-', '', $this->alias)) == '') {
$this->alias = Factory::getDate()->format("Y-m-d-H-i-s");
}
return true;
}
}
?>

View File

@ -0,0 +1 @@
<html><body style="background-color: #000;"></body></html>

View File

@ -0,0 +1 @@
<html><body style="background-color: #000;"></body></html>

View File

@ -0,0 +1,8 @@
ALTER TABLE `#__phocamaps_map` ADD COLUMN `trackfiles_osm` varchar(255) NOT NULL default '';
ALTER TABLE `#__phocamaps_map` ADD COLUMN `trackcolors_osm` varchar(255) NOT NULL default '';
ALTER TABLE `#__phocamaps_map` ADD COLUMN `fitbounds_osm` tinyint(1) NOT NULL default '0';
ALTER TABLE `#__phocamaps_map` ADD COLUMN `gesturehandling` varchar(100) NOT NULL default '';

View File

@ -0,0 +1,5 @@
ALTER TABLE `#__phocamaps_map` ADD COLUMN `custom_options` varchar(255) NOT NULL default '';
ALTER TABLE `#__phocamaps_map` ADD COLUMN `map_styles` text NOT NULL;

View File

@ -0,0 +1,9 @@
ALTER TABLE `#__phocamaps_marker` ADD COLUMN `osm_icon` varchar(100) NOT NULL default '';
ALTER TABLE `#__phocamaps_marker` ADD COLUMN `osm_marker_color` varchar(20) NOT NULL default '';
ALTER TABLE `#__phocamaps_marker` ADD COLUMN `osm_icon_color` varchar(20) NOT NULL default '';
ALTER TABLE `#__phocamaps_marker` ADD COLUMN `osm_icon_prefix` varchar(20) NOT NULL default '';
ALTER TABLE `#__phocamaps_marker` ADD COLUMN `osm_icon_spin` tinyint(1) NOT NULL default '0';
ALTER TABLE `#__phocamaps_marker` ADD COLUMN `osm_icon_class` text NOT NULL;

View File

@ -0,0 +1,3 @@
ALTER TABLE `#__phocamaps_map` CHANGE `width` `width` VARCHAR(50) NOT NULL DEFAULT '';
ALTER TABLE `#__phocamaps_map` CHANGE `height` `height` VARCHAR(50) NOT NULL DEFAULT '';

View File

@ -0,0 +1,2 @@
ALTER TABLE `#__phocamaps_map` ADD COLUMN `autolocation` tinyint(1) NOT NULL default '0';

View File

@ -0,0 +1 @@
<html><body style="background-color: #000;"></body></html>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,74 @@
<?php
/*
* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @component Phoca Gallery
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
$r = $this->r;
echo $r->startCp();
echo '<div class="ph-box-cp">';
echo '<div class="ph-left-cp">';
echo '<div class="ph-cp-item-box">';
$link = 'index.php?option='.$this->t['o'].'&view=';
foreach ($this->views as $k => $v) {
$linkV = $link . $this->t['c'] . $k;
echo $r->quickIconButton( $linkV, Text::_($v[0]), $v[1], $v[2]);
}
echo '</div>';
echo '</div>';
echo '<civ class="ph-right-cp">';
echo '<div class="ph-extension-info-box">';
echo '<div class="ph-cpanel-logo">'.HTMLHelper::_('image', $this->t['i'] . 'logo-'.str_replace('phoca', 'phoca-', $this->t['c']).'.png', 'Phoca.cz') . '</div>';
echo '<div class="ph-cpanel-logo-seal">'. HTMLHelper::_('image', $this->t['i'] . 'logo-phoca.png', 'Phoca.cz' ).'</div>';
echo '<h3>'. Text::_($this->t['l'] . '_VERSION').'</h3>'
.'<p>'. $this->t['version'] .'</p>';
echo '<h3>'. Text::_($this->t['l'] . '_COPYRIGHT').'</h3>'
.'<p>© 2007 - '. date("Y"). ' Jan Pavelka</p>'
.'<p><a href="https://www.phoca.cz/" target="_blank">www.phoca.cz</a></p>';
echo '<h3>'. Text::_($this->t['l'] . '_LICENSE').'</h3>'
.'<p><a href="http://www.gnu.org/licenses/gpl-2.0.html" target="_blank">GPLv2</a></p>';
echo '<h3>'. Text::_($this->t['l'] . '_TRANSLATION').': '. Text::_($this->t['l'] . '_TRANSLATION_LANGUAGE_TAG').'</h3>'
.'<p>© 2007 - '. date("Y"). ' '. Text::_($this->t['l'] . '_TRANSLATER'). '</p>'
.'<p>'.Text::_($this->t['l'] . '_TRANSLATION_SUPPORT_URL').'</p>';
echo '<p>&nbsp;</p><p>Maps are created by OpenStreetmap<br />or by Google Maps™<br />'
.'<p>Google™ is a trademark of <a href="http://www.google.com" target="_blank">Google Inc.</a><br />Google Maps™ is a trademark of <a href="http://www.google.com" target="_blank">Google Inc.</a></p>';
echo '<div class="ph-cp-hr"></div>'
.'<div class="btn-group ph-cp-btn-update"><a class="btn btn-large btn-primary" href="https://www.phoca.cz/version/index.php?'.$this->t['c'].'='. $this->t['version'] .'" target="_blank"><i class="icon-loop icon-white"></i>&nbsp;&nbsp;'. Text::_($this->t['l'] . '_CHECK_FOR_UPDATE') .'</a></div>';
echo '<div class="ph-cp-logo-footer"><a href="https://www.phoca.cz/" target="_blank">'.HTMLHelper::_('image', $this->t['i'] . 'logo.png', 'Phoca.cz' ).'</a></div>';
echo '<div class="ph-cb"></div>';
echo '</div>';
echo '<div class="ph-extension-links-box">';
echo $r->getLinks();
echo '</div>';
echo '</div>';
echo '</div>';
echo $r->endCp();
?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,62 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
jimport( 'joomla.application.component.view' );
class PhocaMapsCpViewPhocaMapsCp extends HtmlView
{
protected $t;
protected $r;
protected $view;
function display($tpl = null) {
$this->t = PhocaMapsUtils::setVars('cp');
$this->r = new PhocaMapsRenderAdminview();
$i = ' icon-';
$d = 'duotone ';
$this->views= array(
'maps' => array($this->t['l'] . '_MAPS', $i.'global', '#01868B'),
'markers' => array($this->t['l'] . '_MARKERS', $d.$i.'location', '#D75348'),
'icons' => array($this->t['l'] . '_ICONS', $d.$i.'flag', '#5CA4CD'),
'info' => array($this->t['l'] . '_INFO', $d.$i.'info-circle', '#3378cc')
);
$this->t['version'] = PhocaMapsHelper::getPhocaVersion('com_phocamaps');
$this->addToolbar();
parent::display($tpl);
}
protected function addToolbar() {
require_once JPATH_COMPONENT.'/helpers/phocamapscp.php';
$state = $this->get('State');
$canDo = PhocaMapsCpHelper::getActions();
ToolbarHelper::title( Text::_( 'COM_PHOCAMAPS_PM_CONTROL_PANEL' ), 'home' );
// This button is unnecessary but it is displayed because Joomla! design bug
$bar = Toolbar::getInstance( 'toolbar' );
$dhtml = '<a href="index.php?option=com_phocamaps" class="btn btn-primary btn-small"><i class="icon-home-2" title="'.Text::_('COM_PHOCAMAPS_CONTROL_PANEL').'"></i> '.Text::_('COM_PHOCAMAPS_CONTROL_PANEL').'</a>';
$bar->appendButton('Custom', $dhtml);
if ($canDo->get('core.admin')) {
ToolbarHelper::preferences('com_phocamaps');
ToolbarHelper::divider();
}
ToolbarHelper::help( 'screen.phocamaps', true );
}
}
?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,87 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Text;
echo '<div id="phocamaps" style="margin:0;padding:0;">';
$id = '';
$map = new PhocaMapsMap($id);
if ($this->type == 'marker') {
$map->loadCoordinatesJS();
}
//$map->loadAPI();
echo '<div align="center" style="margin:0;padding:0">';
echo '<div id="phocaMap'.$id.'" style="width: 100%;height: 85vh;"></div></div>';
echo $map->startJScData();
//echo $map->addAjaxAPI('maps', '3.x', '{"other_params":"sensor=false"}');
echo $map->addAjaxAPI('maps', '3.x', '');
echo $map->addAjaxAPI('search', '1');
echo $map->createMap('phocaMap', 'mapPhocaMap', 'phocaLatLng', 'phocaOptions','tstPhocaMap', 'tstIntPhocaMap', 'phocaGeoCoder', TRUE);
echo $map->cancelEventFunction();
echo $map->checkMapFunction();
echo $map->startMapFunction();
echo $map->setLatLng( $this->latitude, $this->longitude );
echo $map->startMapOptions();
echo $map->setMapOption('zoom', $this->zoom).','."\n";
echo $map->setCenterOpt().','."\n";
echo $map->setTypeControlOpt().','."\n";
echo $map->setNavigationControlOpt().','."\n";
echo $map->setMapOption('scaleControl', 1, TRUE ).','."\n";
echo $map->setMapOption('scrollwheel', 1, TRUE).','."\n";
echo $map->setMapOption('disableDoubleClickZoom', 0).','."\n";
// echo $map->setMapOption('googleBar', $this->map->googlebar).','."\n";// Not ready yet
// echo $map->setMapOption('continuousZoom', $this->map->continuouszoom).','."\n";// Not ready yet
echo $map->setMapTypeOpt()."\n";
echo $map->endMapOptions();
echo $map->setMap();
// echo $map->exportZoom($this->zoom, 'window.top.document.forms.adminForm.elements.zoom');
// echo $map->exportMarker('Global', $this->type, $this->latitude, $this->longitude, 'window.top.document.forms.adminForm.elements.latitude', 'window.top.document.forms.adminForm.elements.longitude');
if ($this->type != 'marker') {
echo $map->exportZoom($this->zoom, '', 'phocaSelectMap_jform_zoom');
}
if ($this->type == 'marker') {
echo $map->exportMarker('Global', $this->type, $this->latitude, $this->longitude, '', '', 'phocaSelectMap_jform_latitude', 'phocaSelectMap_jform_longitude','phocaSelectMap_jform_gpslatitude', 'phocaSelectMap_jform_gpslongitude');
} else {
echo $map->exportMarker('Global', $this->type, $this->latitude, $this->longitude, '', '', 'phocaSelectMap_jform_latitude', 'phocaSelectMap_jform_longitude');
}
//if($map->scrollwheelzoom != 0){
echo $map->setListener();
//}
echo $map->setGeoCoder();
echo $map->endMapFunction();
if ($this->type == 'marker') {
echo $map->addAddressToMapFunction('Global', 'phocaAddressEl', $this->type, '', '', 'phocaSelectMap_jform_latitude', 'phocaSelectMap_jform_longitude','phocaSelectMap_jform_gpslatitude', 'phocaSelectMap_jform_gpslongitude');// no '.id.' - it is set in class
} else {
echo $map->addAddressToMapFunction('Global', 'phocaAddressEl', $this->type, '', '', 'phocaSelectMap_jform_latitude', 'phocaSelectMap_jform_longitude');// no '.id.' - it is set in class
}
echo $map->setInitializeFunctionSpecificMap();
echo $map->setInitializeFunction();
echo $map->endJScData();
echo $map->loadAPI();// must be loaded as last
echo '<div class="p-add-address">'
. '<form class="form-inline" action="#" onsubmit="addAddressToMap'.$id.'(); return false;">'
. '<span>'.Text::_('COM_PHOCAMAPS_SET_COORDINATES_BY_ADDRESS').' : </span>'
. ' <input type="text" name="phocaAddressNameEl'.$id.'" id="phocaAddressEl'.$id.'" value="" class="" style="display:inline;" size="30" />'
. ' <input type="submit" class="btn" name="find" value="'. Text::_('COM_PHOCAMAPS_SET').'" />'
. '</form>'
. '</div>';
echo '</div>';
?>

View File

@ -0,0 +1,164 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Text;
$id = uniqid();
$map = new PhocaMapsMapOsm($id);
$map->loadAPI();
if ($this->type == 'marker') {
$map->loadCoordinatesJS();
}
$map->createMap($this->latitude, $this->longitude, $this->zoom);
$map->setMapType();
$map->setMarker($id, '', '', $this->latitude, $this->longitude);
// Export, Move, Input, renderSearch are dependent
$map->moveMarker();
if ($this->type == 'marker') {
$map->inputMarker('jform_latitude_id', 'jform_longitude_id', '', 1);
} else {
$map->inputMarker('jform_latitude_id', 'jform_longitude_id', 'jform_zoom_id');
}
$map->exportMarker($id);
$map->renderSearch($id);
$map->renderFullScreenControl();
$map->renderCurrentPosition($id);
$map->renderMap();
echo '<div id="phocamaps" style="margin:0;padding:0;">';
echo '<div align="center" style="margin:0;padding:0">';
echo '<div id="phocaMap'.$id.'" style="margin:0;padding:0;width:100%;height:97vh"></div></div>';
/*
$marker = array();
$marker[0] = new stdClass();
$marker[0]->latitude = 40;
$marker[0]->longitude = 12;
$marker[0]->title = 'Marker';
$marker[0]->description = 'Description';
$o = '';
$id = uniqid();
$data_attributes = 'data-unique="' . $id . '"' .
' data-lon="' . $this->longitude . '"' .
' data-lat="' . $this->latitude . '"' .
' data-zoom="' . $this->zoom . '"' .
//' data-scale="' . $this->map->scalecontrol . '"' .
' data-scale="1"' .
' data-show_fullscreencontrol="1" ' .
' data-fullscreencontrol_viewfullscreen="' . Text::_('PLG_AGGPXTRACK_VIEW_FULLSCREEN') . '"' .
' data-fullscreencontrol_exitfullscreen="' . Text::_('PLG_AGGPXTRACK_EXIT_FULLSCREEN') . '"' .
' data-fullscreencontrol_position="topright"' .
' data-currentposition_position="topright"' .
//' data-show_omnivore="' . $this->t['load_kml'] . '"' .
//' data-omnivore_file="' . Uri::base() . "phocamapskml/" . $this->map->kmlfile . '"' .
' data-show_omnivore=""' .
' data-omnivore_file=""' .
' data-omnivore_icon="home"' .
' data-omnivore_markercolor="blue"' .
' data-omnivore_iconcolor="#FFFFFF"' .
' data-omnivore_spin="false"' .
' data-omnivore_extraclasses=""' .
// ' data-specialpins="' . htmlspecialchars(json_encode($this->marker), ENT_QUOTES, 'UTF-8') . '"' .
' data-specialpins="' . htmlspecialchars(json_encode($marker), ENT_QUOTES, 'UTF-8') . '"' .
' data-maptype="osmorg"';
$o .= '<div id="phocamaps-box-leaflet"><div class="pmbox"><div><div><div>';
$o .= '<div id="map' . $id . '" class="phMap" style="width:100%;height: 400px;border: 1px solid red"></div>';
$o .= '</div></div></div></div></div>';
$o .= '<input type="text" id="coordinates" value="" />';
echo $o;
/*$id = '';
$map = new PhocaMapsMap($id);
if ($this->type == 'marker') {
$map->loadCoordinatesJS();
}
//$map->loadAPI();
echo '<div align="center" style="margin:0;padding:0">';
echo '<div id="phocaMap'.$id.'" style="margin:0;padding:0;width:750px;height:480px"></div></div>';
echo $map->startJScData();
//echo $map->addAjaxAPI('maps', '3.x', '{"other_params":"sensor=false"}');
echo $map->addAjaxAPI('maps', '3.x', '');
echo $map->addAjaxAPI('search', '1');
echo $map->createMap('phocaMap', 'mapPhocaMap', 'phocaLatLng', 'phocaOptions','tstPhocaMap', 'tstIntPhocaMap', 'phocaGeoCoder', TRUE);
echo $map->cancelEventFunction();
echo $map->checkMapFunction();
echo $map->startMapFunction();
echo $map->setLatLng( $this->latitude, $this->longitude );
echo $map->startMapOptions();
echo $map->setMapOption('zoom', $this->zoom).','."\n";
echo $map->setCenterOpt().','."\n";
echo $map->setTypeControlOpt().','."\n";
echo $map->setNavigationControlOpt().','."\n";
echo $map->setMapOption('scaleControl', 1, TRUE ).','."\n";
echo $map->setMapOption('scrollwheel', 1, TRUE).','."\n";
echo $map->setMapOption('disableDoubleClickZoom', 0).','."\n";
// echo $map->setMapOption('googleBar', $this->map->googlebar).','."\n";// Not ready yet
// echo $map->setMapOption('continuousZoom', $this->map->continuouszoom).','."\n";// Not ready yet
echo $map->setMapTypeOpt()."\n";
echo $map->endMapOptions();
echo $map->setMap();
// echo $map->exportZoom($this->zoom, 'window.top.document.forms.adminForm.elements.zoom');
// echo $map->exportMarker('Global', $this->type, $this->latitude, $this->longitude, 'window.top.document.forms.adminForm.elements.latitude', 'window.top.document.forms.adminForm.elements.longitude');
if ($this->type != 'marker') {
echo $map->exportZoom($this->zoom, '', 'phocaSelectMap_jform_zoom');
}
if ($this->type == 'marker') {
echo $map->exportMarker('Global', $this->type, $this->latitude, $this->longitude, '', '', 'phocaSelectMap_jform_latitude', 'phocaSelectMap_jform_longitude','phocaSelectMap_jform_gpslatitude', 'phocaSelectMap_jform_gpslongitude');
} else {
echo $map->exportMarker('Global', $this->type, $this->latitude, $this->longitude, '', '', 'phocaSelectMap_jform_latitude', 'phocaSelectMap_jform_longitude');
}
//if($map->scrollwheelzoom != 0){
echo $map->setListener();
//}
echo $map->setGeoCoder();
echo $map->endMapFunction();
if ($this->type == 'marker') {
echo $map->addAddressToMapFunction('Global', 'phocaAddressEl', $this->type, '', '', 'phocaSelectMap_jform_latitude', 'phocaSelectMap_jform_longitude','phocaSelectMap_jform_gpslatitude', 'phocaSelectMap_jform_gpslongitude');// no '.id.' - it is set in class
} else {
echo $map->addAddressToMapFunction('Global', 'phocaAddressEl', $this->type, '', '', 'phocaSelectMap_jform_latitude', 'phocaSelectMap_jform_longitude');// no '.id.' - it is set in class
}
echo $map->setInitializeFunctionSpecificMap();
echo $map->setInitializeFunction();
echo $map->endJScData();
echo $map->loadAPI();// must be loaded as last
echo '<div class="p-add-address">'
. '<form class="form-inline" action="#" onsubmit="addAddressToMap'.$id.'(); return false;">'
. '<span>'.Text::_('COM_PHOCAMAPS_SET_COORDINATES_BY_ADDRESS').' : </span>'
. ' <input type="text" name="phocaAddressNameEl'.$id.'" id="phocaAddressEl'.$id.'" value="" class="" style="display:inline;" size="30" />'
. ' <input type="submit" class="btn" name="find" value="'. Text::_('COM_PHOCAMAPS_SET').'" />'
. '</form>'
. '</div>';*/
echo '</div>';
?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,56 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
jimport( 'joomla.application.component.view');
class PhocaMapsCpViewPhocaMapsGMap extends HtmlView
{
protected $latitude;
protected $longitude;
protected $zoom;
protected $type;
protected $t;
protected $r;
protected $p;
public function display($tpl = null) {
$paramsC = ComponentHelper::getParams('com_phocamaps') ;
$app = Factory::getApplication();
$this->t = PhocaMapsUtils::setVars();
$this->r = new PhocaMapsRenderAdminview();
$this->latitude = $app->input->get( 'lat', '50', 'get', 'string' );
$this->longitude = $app->input->get( 'lng', '-30', 'get', 'string' );
$this->zoom = $app->input->get( 'zoom', '2', 'get', 'string' );
$this->type = $app->input->get( 'type', 'map', 'get', 'string' );
$this->p['enable_ssl'] = $paramsC->get('load_api_ssl', 0);
$this->p['map_type'] = $paramsC->get( 'map_type', 2 );
$document = Factory::getDocument();
$document->addCustomTag( "<style type=\"text/css\"> \n"
." html,body, .contentpane{overflow:hidden;background:#ffffff;} \n"
." </style> \n");
if ($this->p['map_type'] == 2) {
parent::display('osm');
} else {
parent::display($tpl);
}
}
}
?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,74 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
$r = $this->r;
Factory::getDocument()->addScriptDeclaration(
'Joomla.submitbutton = function(task) {
if (task == "'. $this->t['task'].'.cancel" || document.formvalidator.isValid(document.getElementById("adminForm"))) {
Joomla.submitform(task, document.getElementById("adminForm"));
} else {
Joomla.renderMessages({"error": ["'. Text::_('JGLOBAL_VALIDATION_FORM_FAILED', true).'"]});
}
}'
);
echo $r->startForm($this->t['o'], $this->t['task'], $this->item->id, 'adminForm', 'adminForm');
// First Column
echo '<div class="span12 form-horizontal">';
$tabs = array (
'general' => Text::_($this->t['l'].'_GENERAL_OPTIONS'),
'publishing' => Text::_($this->t['l'].'_PUBLISHING_OPTIONS')
);
echo $r->navigation($tabs);
$formArray = array ('title', 'alias');
echo $r->groupHeader($this->form, $formArray, '');
echo $r->startTabs();
echo $r->startTab('general', $tabs['general'], 'active');
if ($this->item->url != '') {
echo '<div class="ph-admin-additional-box">';
echo '<img src="'.$this->item->url.'" alt="" />';
echo '</div>';
}
$formArray = array ('url', 'object', 'objectshape', 'lang','ordering');
echo $r->group($this->form, $formArray);
$formArray = array('description');
echo $r->group($this->form, $formArray, 1);
echo $r->endTab();
echo $r->startTab('publishing', $tabs['publishing']);
foreach($this->form->getFieldset('publish') as $field) {
echo '<div class="control-group">';
if (!$field->hidden) {
echo '<div class="control-label">'.$field->label.'</div>';
}
echo '<div class="controls">';
echo $field->input;
echo '</div></div>';
}
echo $r->endTab();
echo '</div>';//end tab content
echo '</div>';//end span10
echo $r->formInputs();
echo $r->endForm();
?>

Some files were not shown because too many files have changed in this diff Show More