Advertisement
stefan1st

Untitled

Dec 19th, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 30.75 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @package Form Maker
  4.  * @author Web-Dorado
  5.  * @copyright (C) 2011 Web-Dorado. All rights reserved.
  6.  * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
  7.  **/
  8.  
  9.     defined('_JEXEC') or die('Restricted access');
  10.     @session_start();
  11.    
  12.     JHTML::_('behavior.tooltip');
  13.     JHTML::_('behavior.calendar');
  14.     JHTML::_('behavior.modal');
  15.     JHtml::_('behavior.formvalidation');
  16.     JHtml::_('behavior.switcher');
  17.     JHtml::_('formbehavior.chosen', 'select');
  18.     jimport('joomla.filesystem.path');
  19.     jimport('joomla.filesystem.file');
  20.  
  21.     $input_get = JFactory::getApplication()->input;
  22.     $db = JFactory::getDBO();
  23.    
  24.     $rows   = $this->rows;
  25.     $lists = $this->lists;
  26.     $pageNav = $this->pageNav;
  27.     $labels = $this->sorted_labels;
  28.     $label_titles = $this->label_titles;
  29.     $group_id_s = $this->rows_ord;
  30.     $labels_id = $this->sorted_labels_id;
  31.     $sorted_labels_type = $this->sorted_labels_type;
  32.     $total_entries = $this->total_entries;
  33.     $total_views = $this->total_views;
  34.     $join_count = $this->join_count;
  35.     $form_title = $this->form_title;
  36.  
  37.     $form_id = $input_get->getString('id', 0, 'get', 'int');
  38.     $checked_ids = JRequest::getVar('checked_ids');
  39.     $stats_fields = JRequest::getVar('stats_fields');
  40.     $params = explode(',',JRequest::getVar('params'));
  41.     $params = array_slice($params,0, count($params)-1);  
  42.  
  43.     $document = JFactory::getDocument();
  44.     $document->addScript(JURI::root(true).'/components/com_formmaker/views/formmaker/tmpl/wdform.js');
  45.     $document->addScript(JURI::root(true).'/components/com_formmaker/views/formmaker/tmpl/noconflict.js');
  46.     $document->addScript(JURI::root(true).'/components/com_formmaker/views/formmaker/tmpl/cosmetizer.js');
  47.     $document->addStyleSheet(JURI::root(true).'/components/com_formmaker/views/submissions/tmpl/style.css');
  48.  
  49.     $other_fileds = array('submit_id','submit_date', 'submitter_ip', 'username', 'useremail', 'payment_info');
  50.     foreach($other_fileds as $other_filed)
  51.         $$other_filed= false;
  52.  
  53.     if($checked_ids)
  54.     {
  55.         $checked_ids = explode(',',$checked_ids);
  56.         $checked_ids    = array_slice($checked_ids,0, count($checked_ids)-1);              
  57.        
  58.         foreach($other_fileds as $other_filed)
  59.         {
  60.             if(in_array($other_filed, $checked_ids))
  61.                 $$other_filed= true;
  62.         }
  63.     }
  64.     else
  65.     $checked_ids = Array();
  66.    
  67.     $label_titles_copy=$label_titles;
  68.     $language = JFactory::getLanguage();
  69.     $language->load('com_formmaker', JPATH_SITE, null, true);  
  70.    
  71.     ?>
  72.  
  73. <script type="text/javascript">
  74. Joomla.tableOrdering=  function( order, dir, task )
  75. {
  76.     var form = document.adminForm;
  77.     form.filter_order2.value     = order;
  78.     form.filter_order_Dir2.value = dir;
  79.     submitform( task );
  80. }
  81.  
  82. function renderColumns()
  83. {
  84.     allTags=document.getElementsByTagName('*');
  85.    
  86.     for(curTag in allTags)
  87.     {
  88.         if(typeof(allTags[curTag].className)!="undefined")
  89.         if(allTags[curTag].className.indexOf('_fc')>0)
  90.         {
  91.             curLabel=allTags[curTag].className.replace('_fc','');
  92.             if(document.forms.adminForm.hide_label_list.value.indexOf('@'+curLabel+'@')>=0)
  93.                 allTags[curTag].style.display = 'none';
  94.             else
  95.                 allTags[curTag].style.display = '';
  96.         }
  97.     }
  98. }
  99.  
  100. function clickLabChB(label, ChB)
  101. {
  102.     document.forms.adminForm.hide_label_list.value=document.forms.adminForm.hide_label_list.value.replace('@'+label+'@','');
  103.     if(document.forms.adminForm.hide_label_list.value=='') document.getElementById('ChBAll').checked=true;
  104.    
  105.     if(!(ChB.checked))
  106.     {
  107.         document.forms.adminForm.hide_label_list.value+='@'+label+'@';
  108.         document.getElementById('ChBAll').checked=false;
  109.     }
  110.     renderColumns();
  111. }
  112.  
  113. function toggleChBDiv(b)
  114. {
  115.     if(b)
  116.     {
  117.         sizes=window.getSize();
  118.         document.getElementById("sbox-overlay").style.width=sizes.x+"px";
  119.         document.getElementById("sbox-overlay").style.height=sizes.y+"px";
  120.         document.getElementById("ChBDiv").style.left=Math.floor((sizes.x-350)/2)+"px";
  121.        
  122.         document.getElementById("ChBDiv").style.display="block";
  123.         document.getElementById("sbox-overlay").style.display="block";
  124.     }
  125.     else
  126.     {
  127.         document.getElementById("ChBDiv").style.display="none";
  128.         document.getElementById("sbox-overlay").style.display="none";
  129.     }
  130. }
  131.  
  132. function clickLabChBAll(ChBAll)
  133. {
  134.     <?php
  135.     if(isset($labels))
  136.     {
  137.         $templabels=array_merge(array('submitid','submitdate','submitterip','submitterusername','submitteremail'),$labels_id);
  138.         $label_titles=array_merge(array('ID','Submit date', 'Submitter\'s IP Address', 'Submitter\'s Username', 'Submitter\'s Email Address'),$label_titles);
  139.     }
  140.     ?>
  141.  
  142.     if(ChBAll.checked)
  143.     {
  144.         document.forms.adminForm.hide_label_list.value='';
  145.  
  146.         for(i=0; i<=ChBAll.form.length; i++)
  147.             if(typeof(ChBAll.form[i])!="undefined")
  148.                 if(ChBAll.form[i].type=="checkbox")
  149.                     ChBAll.form[i].checked=true;
  150.     }
  151.     else
  152.     {
  153.         document.forms.adminForm.hide_label_list.value='@<?php echo implode($templabels,'@@') ?>@'+'@payment_info@';
  154.  
  155.         for(i=0; i<=ChBAll.form.length; i++)
  156.             if(typeof(ChBAll.form[i])!="undefined")
  157.                 if(ChBAll.form[i].type=="checkbox")
  158.                     ChBAll.form[i].checked=false;
  159.     }
  160.  
  161.     renderColumns();
  162. }
  163.  
  164. function remove_all()
  165. {
  166.     if(document.getElementById('startdate'))
  167.     document.getElementById('startdate').value='';
  168.     if(document.getElementById('enddate'))
  169.     document.getElementById('enddate').value='';
  170.     if(document.getElementById('id_search'))
  171.     document.getElementById('id_search').value='';
  172.     if(document.getElementById('ip_search'))
  173.     document.getElementById('ip_search').value='';
  174.     if(document.getElementById('username_search'))
  175.     document.getElementById('username_search').value='';
  176.     if(document.getElementById('useremail_search'))
  177.     document.getElementById('useremail_search').value='';
  178.     <?php
  179.         $n=count($rows);
  180.    
  181.     for($i=0; $i < count($labels) ; $i++)
  182.     {
  183.     echo "
  184.     if(document.getElementById('".$form_id.'_'.$labels_id[$i]."_search'))
  185.         document.getElementById('".$form_id.'_'.$labels_id[$i]."_search').value='';
  186.     ";
  187.     }
  188.     ?>
  189. }
  190.  
  191. function show_hide_filter()
  192. {  
  193.     if(document.getElementById('fields_filter').style.display=="none")
  194.     {
  195.         document.getElementById('fields_filter').style.display='';
  196.         document.getElementById('filter_img').src='<?php echo JURI::root(true) ?>/components/com_formmaker/images/filter_hide.png';
  197.     }
  198.     else
  199.     {
  200.         document.getElementById('fields_filter').style.display="none";
  201.         document.getElementById('filter_img').src='<?php echo JURI::root(true) ?>/components/com_formmaker/images/filter_show.png';
  202.     }
  203. }
  204. </script>
  205.  
  206.  
  207. <form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post" name="adminForm" id="adminForm">
  208.     <input type="hidden" name="option" value="com_formmaker">
  209.    
  210.     <div class="submission_params">
  211.     <?php if(isset($form_id) and $form_id>0):?>
  212.     <?php if(in_array('title',$params)): ?>
  213.     <div class="form_title"><strong><?php echo $form_title; ?></strong></div>
  214.     <?php endif; ?>
  215.     <div>
  216.         <?php if(in_array('entries',$params)):?>
  217.             <div class="reports" style="width: 80px;"><strong>Înregistrări<!--<?php echo addslashes(JText::_('WDF_ENTRIES')); ?>--></strong><br /><?php echo $total_entries; ?></div>
  218.         <?php endif; if(in_array('views',$params)): ?>
  219.             <div class="reports" style="width: 80px;"><strong><?php echo addslashes(JText::_('WDF_VIEWS')); ?></strong><br /><?php echo $total_views ?></div>
  220.         <?php endif; if(in_array('conversion_rate',$params)): ?>
  221.             <div class="reports" style="width: 112px;"><strong><?php echo addslashes(JText::_('WDF_CONVERSION_RATE')); ?></strong><br /><?php  if($total_views) echo round((($total_entries/$total_views)*100),2).'%'; else echo '0%' ?></div>
  222.         <?php endif; if(in_array('csv',$params) || in_array('xml',$params)):?>
  223.             <div <?php echo ((in_array('entries',$params) || in_array('views',$params) || in_array('conversion_rate',$params)) ? 'class="csv_xml"' : '') ?>>
  224.             Export
  225.             <?php if(in_array('csv',$params)): ?>
  226.             <input type="button" value="CSV" onclick="window.location='<?php echo ($_SERVER['QUERY_STRING'] ? $_SERVER['REQUEST_URI'].'&' : $_SERVER['REQUEST_URI']."/?"); ?>task=generate_csv&tmpl=component'" />&nbsp;
  227.             <?php endif; ?>
  228.             <?php if(in_array('xml',$params)): ?>
  229.             <input type="button" value="XML" onclick="window.location='<?php echo ($_SERVER['QUERY_STRING'] ? $_SERVER['REQUEST_URI'].'&' : $_SERVER['REQUEST_URI']."/?"); ?>task=generate_xml&tmpl=component'" />&nbsp;
  230.             <?php endif; ?>
  231.             </div>
  232.         <?php endif; ?>
  233.     </div>
  234.     <?php if(in_array('search',$params) || in_array('pagination',$params)): ?>
  235.     <div class="search_and_pagination">
  236.         <?php if(in_array('search',$params)): ?>
  237.         <div>
  238.             <input type="hidden" name="hide_label_list" value="<?php  echo $lists['hide_label_list']; ?>" />
  239.             <img id="filter_img" src="components/com_formmaker/images/filter_show.png" width="40" style="vertical-align:middle; cursor:pointer" onclick="show_hide_filter()"  title="Search by fields" />
  240.             <input type="button" onclick="this.form.submit();" style="vertical-align:middle; cursor:pointer" value="<?php echo JText::_( 'Caută' ); ?>" />
  241.             <input type="button" onclick="remove_all();this.form.submit();" style="vertical-align:middle; cursor:pointer" value="<?php echo JText::_( 'Reset' ); ?>" />
  242.             <input type="button" onclick="" style="vertical-align:middle; cursor:pointer" value="<?php echo JText::_( 'Save' ); ?>" />
  243.         </div>
  244.         <div>
  245.         <?php if($join_count) echo ($total_entries-$join_count).' of '.$total_entries.' submissions are not shown, as the field you sorted by is missing in those submissions.'; ?>
  246.         </div>
  247.         <?php endif; if(in_array('pagination',$params)): ?>
  248.         <div class="submits_pagination">
  249.             <?php echo $pageNav->getLimitBox(); ?>
  250.         </div> 
  251.         <?php endif; ?>        
  252.     </div>
  253.     <?php endif; ?>
  254.     <?php endif; ?>
  255.     </div>
  256.    
  257.     <div style="overflow-x:scroll;">
  258.     <form action="index.php?option=com_formmaker&task=submits" method="post" name="adminForm" id="adminForm">
  259.         <table class="submissions" width="100%">
  260.             <thead>
  261.                 <tr>
  262.                     <th width="3%"><?php echo '#'; ?></th>
  263.                     <th>Status</th>
  264.                     <?php
  265.                     if($submit_id)
  266.                     {
  267.                         echo '<th width="4%" class="submitid_fc"';
  268.                         if(!(strpos($lists['hide_label_list'],'@submitid@')===false))
  269.                         echo 'style="display:none;"';
  270.                         echo '>';
  271.                         if(in_array('ordering',$params))
  272.                         echo JHTML::_('grid.sort', 'Id', 'group_id', @$lists['order_Dir'], @$lists['order'] );
  273.                         else
  274.                         echo 'Id';
  275.                         echo '</th>';
  276.                     }
  277.                    
  278.                     if($submit_date)
  279.                     {
  280.                         echo '<th width="150" align="center" class="submitdate_fc"';
  281.                         if(!(strpos($lists['hide_label_list'],'@submitdate@')===false))
  282.                         echo 'style="display:none;"';
  283.                         echo '>';
  284.                         if(in_array('ordering',$params))
  285.                         echo JHTML::_('grid.sort', 'Submit Date', 'date', @$lists['order_Dir'], @$lists['order'] );
  286.                         else
  287.                         echo 'Submit Date';
  288.                         echo '</th>';
  289.                     }
  290.                        
  291.                     if($submitter_ip)
  292.                     {
  293.                         echo '<th width="100" align="center" class="submitterip_fc"';
  294.                         if(!(strpos($lists['hide_label_list'],'@submitterip@')===false))
  295.                         echo 'style="display:none;"';
  296.                         echo '>';
  297.                         if(in_array('ordering',$params))
  298.                         echo JHTML::_('grid.sort', 'Submitter\'s IP Address', 'ip', @$lists['order_Dir'], @$lists['order'] );
  299.                         else
  300.                         echo 'Submitter\'s IP Address';
  301.                         echo '</th>';
  302.                     }
  303.                  
  304.                     if($username)
  305.                     {
  306.                         echo '<th width="100" class="submitterusername_fc"';
  307.                         if(!(strpos($lists['hide_label_list'],'@submitterusername@')===false))
  308.                         echo 'style="display:none;"';
  309.                         echo '>';
  310.                         if(in_array('ordering',$params))
  311.                         echo JHTML::_('grid.sort', 'Submitter\'s Username', 'username', @$lists['order_Dir'], @$lists['order'] );
  312.                         else
  313.                         echo 'Submitter\'s Username';
  314.                         echo '</th>';
  315.                     }
  316.                    
  317.                     if($useremail)
  318.                     {
  319.                         echo '<th width="100" class="submitteremail_fc"';
  320.                         if(!(strpos($lists['hide_label_list'],'@submitteremail@')===false))
  321.                         echo 'style="display:none;"';
  322.                         echo '>';
  323.                         if(in_array('ordering',$params))
  324.                         echo JHTML::_('grid.sort', 'Submitter\'s Email Address', 'email', @$lists['order_Dir'], @$lists['order'] );
  325.                         else
  326.                         echo 'Submitter\'s Email Address';
  327.                         echo '</th>';
  328.                     }
  329.                      
  330.                     $n=count($rows);
  331.                     $ispaypal=false;
  332.                     for($i=0; $i < count($labels) ; $i++)
  333.                     {
  334.                         if(in_array($labels_id[$i], $checked_ids))
  335.                         {
  336.                             if(strpos($lists['hide_label_list'],'@'.$labels_id[$i].'@')===false)  $styleStr='';
  337.                             else $styleStr='style="display:none;"';
  338.                            
  339.                             $field_title=$label_titles_copy[$i];
  340.                                
  341.                             if($sorted_labels_type[$i]=='type_paypal_payment_status')      
  342.                             {  
  343.                                 $ispaypal=true;
  344.                                 echo '<th align="center" class="'.$labels_id[$i].'_fc" '.$styleStr.'>';
  345.                                 if(in_array('ordering',$params))
  346.                                 echo JHTML::_('grid.sort', $field_title, $labels_id[$i]."_field", @$lists['order_Dir'], @$lists['order'] );
  347.                                 else
  348.                                 echo $field_title;
  349.                                 echo '</th>';
  350.                                    
  351.                             }
  352.                             else
  353.                             {
  354.                                 echo '<th align="center" class="'.$labels_id[$i].'_fc" '.$styleStr.'>';
  355.                                 if(in_array('ordering',$params))
  356.                                 echo JHTML::_('grid.sort', $field_title, $labels_id[$i]."_field", @$lists['order_Dir'], @$lists['order'] );
  357.                                 else
  358.                                 echo $field_title;
  359.                                 echo '</th>';
  360.                             }
  361.                         }
  362.                     }
  363.                     if($payment_info)      
  364.                     {
  365.                         if(strpos($lists['hide_label_list'],'@payment_info@')===false)  
  366.                             $styleStr2='aa';
  367.                         else
  368.                             $styleStr2='style="display:none;"';
  369.                         echo '<th class="payment_info_fc" '.$styleStr2.'>Payment Info</th>';
  370.                     }  
  371.                 ?>
  372.                 </tr>
  373.                 <tr id="fields_filter" style="display:none">
  374.                     <th width="3%"></th>
  375.                     <?php if($submit_id): ?>
  376.                     <th width="4%" class="submitid_fc" <?php if(!(strpos($lists['hide_label_list'],'@submitid@')===false)) echo 'style="display:none;"';?> >
  377.                     <input type="text" name="id_search" id="id_search" value="<?php echo $lists['id_search'] ?>" onChange="this.form.submit();" style="width:50px"/>
  378.                     </th>
  379.                     <?php endif;
  380.                    
  381.                     if($submit_date): ?>
  382.                     <th class="submitdate_fc" style="text-align:left; <?php if(!(strpos($lists['hide_label_list'],'@submitdate@')===false)) echo 'display:none;';?>" align="center">
  383.                     <table class="simple_table">
  384.                         <tr>
  385.                             <td>De la:</td>
  386.                             <td><input class="inputbox" type="text" name="startdate" id="startdate" maxlength="10" value="<?php echo $lists['startdate'];?>" /> </td>
  387.                             <td><button class="btn" id="startdate_but"><i class="icon-calendar"></i></button></td>
  388.                         </tr>
  389.                         <tr>
  390.                             <td>Până la:</td>
  391.                             <td><input class="inputbox" type="text" name="enddate" id="enddate" maxlength="10" value="<?php echo $lists['enddate'];?>" /> </td>
  392.                             <td><button class="btn" id="enddate_but"><i class="icon-calendar"></i></button></td>
  393.                         </tr>
  394.                     </table>
  395.                    
  396.                     </th>
  397.                     <?php endif;
  398.  
  399.                     if($submitter_ip): ?>
  400.                     <th class="submitterip_fc"  <?php if(!(strpos($lists['hide_label_list'],'@submitterip@')===false)) echo 'style="display:none;"';?>>
  401.                      <input type="text" name="ip_search" id="ip_search" value="<?php echo $lists['ip_search'] ?>" onChange="this.form.submit();" style="width:96%"/>
  402.                     </th>
  403.                     <?php endif;         
  404.                     if($username): ?>      
  405.                     <th width="100"class="submitterusername_fc"  <?php if(!(strpos($lists['hide_label_list'],'@submitterusername@')===false)) echo 'style="display:none;"';?>>
  406.                          <input type="text" name="username_search" id="username_search" value="<?php echo $lists['username_search'] ?>" onChange="this.form.submit();" style="width:150px"/>
  407.                         </th>
  408.                     <?php endif;    
  409.                     if($useremail): ?>     
  410.                         <th width="100"class="submitteremail_fc"  <?php if(!(strpos($lists['hide_label_list'],'@submitteremail@')===false)) echo 'style="display:none;"'; ?>>
  411.                          <input type="text" name="useremail_search" id="useremail_search" value="<?php echo $lists['useremail_search'] ?>" onChange="this.form.submit();" style="width:150px"/>
  412.                         </th>
  413.                     <?php endif;
  414.                    
  415.                         $ka_fielderov_search=false;
  416.                        
  417.                         if($lists['id_search'] || $lists['ip_search'] || $lists['startdate'] || $lists['enddate'] || $lists['username_search'] || $lists['useremail_search']){
  418.                             $ka_fielderov_search=true;
  419.                         }
  420.                    
  421.                         for($i=0; $i < count($labels) ; $i++)
  422.                         {
  423.                             if(strpos($lists['hide_label_list'],'@'.$labels_id[$i].'@')===false)  
  424.                                 $styleStr='';
  425.                             else
  426.                                 $styleStr='style="display:none;"';
  427.                            
  428.                             if(!$ka_fielderov_search)
  429.                                 if($lists[$form_id.'_'.$labels_id[$i].'_search'])
  430.                                 {
  431.                                     $ka_fielderov_search=true;
  432.                                 }
  433.                
  434.                             if(in_array($labels_id[$i], $checked_ids))     
  435.                             switch($sorted_labels_type[$i])
  436.                             {
  437.                                 case 'type_mark_map': echo '<th class="'.$labels_id[$i].'_fc" '.$styleStr.'>'.'</th>'; break;
  438.                                 case 'type_paypal_payment_status':
  439.                                 echo '<th class="'.$labels_id[$i].'_fc" '.$styleStr.'>';
  440.                                 ?>
  441.                                 <select name="<?php echo $form_id.'_'.$labels_id[$i]; ?>_search" id="<?php echo $form_id.'_'.$labels_id[$i]; ?>_search" onChange="this.form.submit();" value="<?php echo $lists[$form_id.'_'.$labels_id[$i].'_search']; ?>" >
  442.                                     <option value="" ></option>
  443.                                     <option value="canceled" >Canceled</option>
  444.                                     <option value="cleared" >Cleared</option>
  445.                                     <option value="cleared by payment review" >Cleared by payment review</option>
  446.                                     <option value="completed" >Completed</option>
  447.                                     <option value="denied" >Denied</option>
  448.                                     <option value="failed" >Failed</option>
  449.                                     <option value="held" >Held</option>
  450.                                     <option value="in progress" >In progress</option>
  451.                                     <option value="on hold" >On hold</option>
  452.                                     <option value="paid" >Paid</option>
  453.                                     <option value="partially refunded" >Partially refunded</option>
  454.                                     <option value="pending verification" >Pending verification</option>
  455.                                     <option value="placed" >Placed</option>
  456.                                     <option value="processing" >Processing</option>
  457.                                     <option value="refunded" >Refunded</option>
  458.                                     <option value="refused" >Refused</option>
  459.                                     <option value="removed" >Removed</option>
  460.                                     <option value="returned" >Returned</option>
  461.                                     <option value="reversed" >Reversed</option>
  462.                                     <option value="temporary hold" >Temporary hold</option>
  463.                                     <option value="unclaimed" >Unclaimed</option>
  464.                                 </select>  
  465.                                 <script>
  466.                                 var element = document.getElementById('<?php echo $form_id.'_'.$labels_id[$i]; ?>_search');
  467.                                 element.value = '<?php echo $lists[$form_id.'_'.$labels_id[$i].'_search']; ?>';
  468.                                 </script>
  469.                                 <?php              
  470.                                 echo '</th>';
  471.  
  472.                                 break;
  473.                                 default :  
  474.                                 echo '<th class="'.$labels_id[$i].'_fc" '.$styleStr.'>'.'<input name="'.$form_id.'_'.$labels_id[$i].'_search" id="'.$form_id.'_'.$labels_id[$i].'_search" type="text" value="'.$lists[$form_id.'_'.$labels_id[$i].'_search'].'"  onChange="this.form.submit();" style="width:96%">'.'</th>';
  475.                                 break;         
  476.                            
  477.                             }
  478.                         }
  479.                         if($payment_info)
  480.                         {
  481.                             if(strpos($lists['hide_label_list'],'@payment_info@')===false)  
  482.                                 $styleStr2='';
  483.                             else
  484.                                 $styleStr2='style="display:none;"';
  485.                             echo '<th class="payment_info_fc" '.$styleStr2.'></th>';
  486.                         }  
  487.                     ?>
  488.                 </tr>
  489.                 </thead>
  490.         <?php if(in_array('pagination',$params)): ?>
  491.             <tfoot>
  492.                 <tr>
  493.                     <td colspan="100"> <?php echo $pageNav->getListFooter(); ?>
  494.  
  495.                     </td>
  496.                 </tr>
  497.             </tfoot>
  498.         <?php endif;
  499.     $k = 0;
  500.     $m=count($labels);
  501.  
  502.     for($www=0, $qqq=count($group_id_s); $www < $qqq ; $www++)
  503.     {  
  504.         $i=$group_id_s[$www];
  505.  
  506.         $temp= array();
  507.         for($j=0; $j < $n ; $j++)
  508.         {
  509.             $row = &$rows[$j];
  510.             if($row->group_id==$i)
  511.             {
  512.                 array_push($temp, $row);
  513.             }
  514.         }
  515.         $f=$temp[0];
  516.         $resolved=$f->resolved;
  517.         $date=$f->date;
  518.         $ip = $f->ip;
  519.         $user_id = JFactory::getUser($f->user_id);
  520.         $user_name = $user_id->username;
  521.         $user_email= $user_id->email;
  522.  
  523.         $checked    = JHTML::_('grid.id', $www, $group_id_s[$www]);
  524.         ?>
  525.  
  526.         <tr class="<?php echo "row$k"; ?>">
  527.  
  528.             <td align="center"><?php echo $www+1+$pageNav->limitstart;?></td>
  529.            
  530.             <?php
  531.             if(1==1)
  532.             {
  533.                 if($resolved == 0)
  534.                     echo '<td align="center">
  535.                             <input type="checkbox">Closed</input>
  536.                           </td>';
  537.                 else
  538.                     echo '<td align="center"><input type="checkbox" checked>Closed</input></td>';
  539.             }
  540.  
  541.             if($submit_id)
  542.             {
  543.                 if(strpos($lists['hide_label_list'],'@submitid@')===false)
  544.                 echo '<td align="center" class="submitid_fc">'.$f->group_id.'</td>';
  545.                 else
  546.                 echo '<td align="center" class="submitid_fc" style="display:none;">'.$f->group_id.'</td>';
  547.             }
  548.            
  549.             if($submit_date)
  550.             {
  551.                 if(strpos($lists['hide_label_list'],'@submitdate@')===false)
  552.                 echo '<td align="center" class="submitdate_fc">'.$date.'</td>';
  553.                 else
  554.                 echo '<td align="center" class="submitdate_fc" style="display:none;">'.$date.'</td>';
  555.             }
  556.  
  557.             if($submitter_ip)
  558.             {
  559.                
  560.                 if(strpos($lists['hide_label_list'],'@submitterip@')===false)
  561.                 echo '<td align="center" class="submitterip_fc">'.$ip.'</td>';
  562.                 else
  563.                 echo '<td align="center" class="submitterip_fc" style="display:none;">'.$ip.'</td>';
  564.             }
  565.  
  566.             if($username)
  567.             {
  568.                 if(strpos($lists['hide_label_list'],'@submitterusername@')===false)
  569.                 echo '<td align="center" class="submitterusername_fc" style="display:table-cell;">'.$user_name.'</td>';
  570.                 else
  571.                 echo '<td align="center" class="submitterusername_fc" style="display:none;">'.$user_name.'</td>';
  572.             }
  573.  
  574.             if($useremail)
  575.             {
  576.                 if(strpos($lists['hide_label_list'],'@submitteremail@')===false)
  577.                 echo '<td align="center" class="submitteremail_fc" style="display:table-cell;">'.$user_email.'</td>';
  578.                 else
  579.                 echo '<td align="center" class="submitteremail_fc" style="display:none;">'.$user_email.'</td>';
  580.             }
  581.            
  582.             $ttt=count($temp);
  583.             for($h=0; $h < $m ; $h++)
  584.             {  
  585.                 if(in_array($labels_id[$h], $checked_ids)) 
  586.                 {
  587.                     $not_label=true;
  588.                     for($g=0; $g < $ttt ; $g++)
  589.                     {          
  590.                         $t = $temp[$g];
  591.                         if(strpos($lists['hide_label_list'],'@'.$labels_id[$h].'@')===false)
  592.                             $styleStr='';
  593.                         else
  594.                             $styleStr='style="display:none;"';
  595.                         if($t->element_label==$labels_id[$h])
  596.                         {
  597.                             if(strpos($t->element_value,"***map***"))
  598.                             {
  599.                                 $map_params=explode('***map***',$t->element_value);
  600.                                
  601.                                 $longit =$map_params[0];
  602.                                 $latit  =$map_params[1];
  603.                                
  604.                                 echo  '<td align="center" class="'.$labels_id[$h].'_fc" '.$styleStr.'><a class="modal"  href="index.php?option=com_formmaker&task=show_map&long='.$longit.'&lat='.$latit.'&tmpl=component" rel="{handler: \'iframe\', size: {x:630, y: 570}}">'.'Show on Map'."</a></td>";
  605.                             }
  606.                             else
  607.                                 if(strpos($t->element_value,"*@@url@@*"))
  608.                                 {
  609.                                     echo  '<td align="center" class="'.$labels_id[$h].'_fc" '.$styleStr.'>';
  610.                                     $new_files=explode("*@@url@@*", $t->element_value);
  611.  
  612.                                     foreach($new_files as $new_file)
  613.                                     if($new_file)
  614.                                     {
  615.                                         $new_filename=explode('/', $new_file);
  616.                                         $new_filename=$new_filename[count($new_filename)-1];
  617.                                         if(strpos(strtolower($new_filename), 'jpg')!== false or strpos(strtolower($new_filename), 'png')!== false or strpos(strtolower($new_filename), 'gif')!== false or strpos(strtolower($new_filename), 'jpeg')!== false)
  618.                                             echo  '<a href="'.$new_file.'" class="modal">'.$new_filename."</a></br>";
  619.                                         else
  620.                                             echo  '<a target="_blank" href="'.$new_file.'">'.$new_filename."</a></br>";
  621.                                     }
  622.                                     echo "</td>";      
  623.                                 }
  624.                                 else
  625.                                     if(strpos($t->element_value,"@@@")>-1 || $t->element_value=="@@@" || $t->element_value=="@@@@@@@@@" || $t->element_value=="::" || $t->element_value==":" || $t->element_value=="--")
  626.                                     {
  627.                                         echo  '<td align="center" class="'.$labels_id[$h].'_fc" '.$styleStr.'><pre style="font-family:inherit">'.str_replace(array("@@@",":","-")," ",$t->element_value).'</pre></td>';
  628.                                     }  
  629.                                     else
  630.                                         if(strpos($t->element_value,"***grading***"))
  631.                                         {  
  632.                                             $new_filename= str_replace("***grading***",'', $t->element_value); 
  633.                                             $grading = explode(":",$new_filename);                        
  634.                                            
  635.                                             $items_count = sizeof($grading)-1;
  636.                                             $items = "";
  637.                                             $total = "";
  638.                                        
  639.                                             for($k=0;$k<$items_count/2;$k++)
  640.                                             {
  641.                                                 $items .= $grading[$items_count/2+$k].": ".$grading[$k]."</br>";
  642.                                                 $total += $grading[$k];
  643.                                             }
  644.                                            
  645.                                             $items .="Total: ".$total;
  646.                                        
  647.                                             echo  '<td align="center" class="'.$labels_id[$h].'_fc" '.$styleStr.'><pre style="font-family:inherit">'.$items.'</pre></td>';
  648.                                         }      
  649.                                         else
  650.                                             if(strpos($t->element_value,"***matrix***"))
  651.                                             {  
  652.                                            
  653.                                                 echo  '<td align="center" class="'.$labels_id[$h].'_fc" '.$styleStr.'><a class="modal"  href="index.php?option=com_formmaker&task=show_matrix&matrix_params='.$t->element_value.'&tmpl=component" rel="{handler: \'iframe\', size: {x:650, y: 450}}">'.'Show Matrix'.'</a></td>';
  654.                                             }
  655.                                             else
  656.                                             {
  657.                                                 if(strpos($t->element_value, "***quantity***"))
  658.                                                     $t->element_value = str_replace("***quantity***"," ",$t->element_value);
  659.  
  660.                                                 if(strpos($t->element_value,"***property***"))
  661.                                                     $t->element_value = str_replace("***property***"," ",$t->element_value);
  662.                                    
  663.                                                 echo  '<td align="center" class="'.$labels_id[$h].'_fc" '.$styleStr.'><pre style="font-family:inherit; white-space: pre;">'.str_replace("***br***",'<br>', $t->element_value).'</pre></td>';
  664.                                             }  
  665.                                             $not_label=false;
  666.                         }
  667.                     }
  668.                     if($not_label)
  669.                             echo  '<td align="center" class="'.$labels_id[$h].'_fc" '.$styleStr.'></td>';
  670.                 }
  671.             }
  672.            
  673.             if($payment_info)
  674.             {
  675.                 if(strpos($lists['hide_label_list'],'@payment_info@')===false)
  676.                     $styleStr='';
  677.                 else
  678.                     $styleStr='style="display:none;"';
  679.                 echo  '<td align="center" class="payment_info_fc" '.$styleStr.'>       
  680.                 <a class="modal" href="index.php?option=com_formmaker&amp;task=paypal_info&amp;tmpl=component&amp;id='.$i.'" rel="{handler: \'iframe\', size: {x:703, y: 550}}"><img src="components/com_formmaker/images/info.png" /></a></td>';
  681.             }
  682.         ?>
  683.         </tr>
  684.         <?php
  685.         $k = 1 - $k;
  686.     }
  687.     ?>
  688.         </table>
  689.     </form>
  690.     </div>
  691.  
  692.     <?php
  693.     $is_stats=false;
  694.     if(in_array('stats',$params))
  695.     {
  696.         foreach($sorted_labels_type as $key => $label_type)
  697.         {
  698.             if($label_type=="type_checkbox" || $label_type=="type_radio" || $label_type=="type_own_select" || $label_type=="type_country" || $label_type=="type_paypal_select" || $label_type=="type_paypal_radio" || $label_type=="type_paypal_checkbox" || $label_type=="type_paypal_shipping")
  699.             {
  700.                 $is_stats=true;
  701.                 break;
  702.                
  703.             }
  704.         }
  705.        
  706.         if($is_stats)
  707.         {
  708.             ?>
  709.             <br><br>
  710.             <h1 style="border-bottom: 1px solid; color:#000 !important;">Statistici</h1>
  711.            
  712.             <table class="stats">
  713.                 <tr valign="top">
  714.                     <td class="key" style="vertical-align: middle;">
  715.                         <label> <?php echo JText::_( 'Selectați un câmp' ); ?>: </label>
  716.                     </td>
  717.                     <td>
  718.                         <select id="stat_id">
  719.                         <option value="">Selectați câmpul</option>;
  720.                         <?php
  721.                             $stats_fields = explode(',',$stats_fields);
  722.                             $stats_fields   = array_slice($stats_fields,0, count($stats_fields)-1);
  723.                            
  724.                             foreach($sorted_labels_type as $key => $label_type)
  725.                             {
  726.                                 if(($label_type=="type_checkbox" || $label_type=="type_radio" || $label_type=="type_own_select" || $label_type=="type_country" || $label_type=="type_paypal_select" || $label_type=="type_paypal_radio" || $label_type=="type_paypal_checkbox" || $label_type=="type_paypal_shipping") && in_array($labels_id[$key], $stats_fields))
  727.                                 {
  728.                                     echo '<option value="'.$labels_id[$key].'">'.$label_titles_copy[$key].'</option>';
  729.                                 }
  730.                             }
  731.                         ?>
  732.                         </select>
  733.                     </td>
  734.                 </tr>
  735.                 <tr valign="middle">
  736.                     <td class="key" style="vertical-align: middle;">
  737.                         <label> <?php echo JText::_( 'Selectați data' ); ?>: </label>
  738.                     </td>
  739.                     <td>
  740.                         De la:<input class="inputbox" type="text" name="startstats" id="startstats"  maxlength="10" />
  741.                             <button class="btn" id="startstats_but"><i class="icon-calendar"></i></button>
  742.                         Până la: <input class="inputbox" type="text" name="endstats" id="endstats"  maxlength="10" />
  743.                             <button class="btn" id="endstats_but"><i class="icon-calendar"></i></button>
  744.                     </td>
  745.                 </tr>
  746.                 <tr valign="top">
  747.                     <td class="key" style="vertical-align: middle;" colspan="2">
  748.                     <input type="button" onclick="show_stats()" style="vertical-align:middle; cursor:pointer" value="Arată">
  749.                     </td>
  750.                 </tr>
  751.                
  752.             </table>
  753.  
  754.             <div id="div_stats">
  755.             </div>
  756.            
  757.             <script>
  758.             Calendar.setup({
  759.                     inputField: "startstats",
  760.                     ifFormat: "%Y-%m-%d",
  761.                     button: "startstats_but",
  762.                     align: "Tl",
  763.                     singleClick: true,
  764.                     firstDay: 0
  765.                     });
  766.                    
  767.             Calendar.setup({
  768.                     inputField: "endstats",
  769.                     ifFormat: "%Y-%m-%d",
  770.                     button: "endstats_but",
  771.                     align: "Tl",
  772.                     singleClick: true,
  773.                     firstDay: 0
  774.                     });
  775.                    
  776.             function show_stats()
  777.             {
  778.             wdformjQuery('#div_stats').html('<div id="saving"><div id="saving_text">Loading</div><div id="fadingBarsG"><div id="fadingBarsG_1" class="fadingBarsG"></div><div id="fadingBarsG_2" class="fadingBarsG"></div><div id="fadingBarsG_3" class="fadingBarsG"></div><div id="fadingBarsG_4" class="fadingBarsG"></div><div id="fadingBarsG_5" class="fadingBarsG"></div><div id="fadingBarsG_6" class="fadingBarsG"></div><div id="fadingBarsG_7" class="fadingBarsG"></div><div id="fadingBarsG_8" class="fadingBarsG"></div></div></div>');
  779.            
  780.            
  781.             if(wdformjQuery('#stat_id').val()!="")
  782.                 wdformjQuery('#div_stats').load('index.php?option=com_formmaker&view=stats&form_id=<?php echo $form_id;?>&id='+wdformjQuery('#stat_id').val()+'&from='+wdformjQuery('#startstats').val()+'&to='+wdformjQuery('#endstats').val()+"&tmpl=component");
  783.             else
  784.                 wdformjQuery('#div_stats').html("Please select the field!")
  785.  
  786.             }
  787.             </script>
  788.             <?php
  789.         }
  790.     }
  791.     ?>
  792.  
  793.     <input type="hidden" name="boxchecked" value="0">
  794.     <input type="hidden" name="filter_order2" value="<?php echo $lists['order']; ?>" />
  795.     <input type="hidden" name="filter_order_Dir2" value="<?php echo $lists['order_Dir']; ?>" />
  796.  
  797. </form>
  798. <?php if($submit_date): ?>
  799. <script>
  800.     Calendar.setup({
  801.             inputField: "startdate",
  802.             ifFormat: "%Y-%m-%d",
  803.             button: "startdate_but",
  804.             align: "Tl",
  805.             singleClick: true,
  806.             firstDay: 0
  807.             });
  808.            
  809.     Calendar.setup({
  810.             inputField: "enddate",
  811.             ifFormat: "%Y-%m-%d",
  812.             button: "enddate_but",
  813.             align: "Tl",
  814.             singleClick: true,
  815.             firstDay: 0
  816.             });
  817. </script>
  818. <?php endif; ?>        
  819.            
  820. <?php if($ka_fielderov_search):?>
  821. <script>
  822. document.getElementById('fields_filter').style.display='';
  823. document.getElementById('filter_img').src='<?php echo JURI::root(true) ?>/components/com_formmaker/images/filter_hide.png';
  824. </script>
  825. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement