Changeset 4260
- Timestamp:
- Nov 12, 2009, 9:56:21 PM (15 years ago)
- Location:
- extensions/ConcoursPhoto
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ConcoursPhoto/admin/params.php
r4252 r4260 14 14 15 15 $concours->my_config['mask_author'] = isset($_POST['mask_author']); 16 $concours->my_config['thumb_note'] = isset($_POST['thumb_note']); 16 17 17 18 $concours->save_config(); … … 28 29 'SHOW_MENUBAR' => ($concours->my_config['active_menubar'] ? 'checked="checked"' : ''), 29 30 'MASK_AUTHOR' => ($concours->my_config['mask_author'] ? 'checked="checked"' : ''), 31 'THUMB_NOTE' => ($concours->my_config['thumb_note'] ? 'checked="checked"' : ''), 30 32 )); 31 33 -
extensions/ConcoursPhoto/admin/template/params.tpl
r4252 r4260 30 30 <TD colspan="2"> 31 31 <input type="checkbox" name="mask_author" {$MASK_AUTHOR}/> {'concours_mask_author'|@translate} 32 <br/> 33 </TD> 34 </TR> 35 <TR> 36 <TD colspan="2"> 37 <input type="checkbox" name="thumb_note" {$THUMB_NOTE}/> {'concours_thumb_note'|@translate} 32 38 <br/> 33 39 </TD> -
extensions/ConcoursPhoto/include/Concours.class.php
r4254 r4260 724 724 } 725 725 // END DEBUG 726 727 728 // disable author name on image which are present in a concours. 729 // check the categories where the current image is present and disable the author name 730 if ($this->my_config['mask_author'] && $this->my_config['mask_author'] == true) 731 { 732 // Get all categories where the current image is present 733 $query = ' 734 SELECT category_id,uppercats,commentable,global_rank 735 FROM '.IMAGE_CATEGORY_TABLE.' 736 INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id 737 WHERE image_id = '.$page['image_id'].' 738 ;'; 739 // echo $query; 740 $result = pwg_query($query); 741 $related_categories = array(); 742 while ($row = mysql_fetch_array($result)) 743 { 744 array_push($related_categories, $row['category_id']); 745 } 746 // 747 //echo related_categories; 748 if (count($related_categories)) 749 { 750 // Request for all concours prepared & actived on each categories 751 $query = ' 752 SELECT * 753 FROM ' . CONCOURS_TABLE .' 754 WHERE category IN ('.implode(',', $related_categories).') 755 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0 756 '; 757 // echo $query; 758 $result = pwg_query($query); 759 // If one or more concours are found, the author name is masked 760 if ($result && mysql_fetch_assoc($result)) 761 $template->assign('INFO_AUTHOR',l10n('concours_img_author')); 762 } 763 } 764 765 // End disable author name 766 767 726 768 if (($page['section']) == 'categories' AND !empty($page['category'])) 727 769 { … … 729 771 //------------ 730 772 // Step 1 731 773 774 /* 732 775 if ($this->my_config['mask_author'] && $this->my_config['mask_author'] == true) 733 776 { … … 744 787 $template->assign('INFO_AUTHOR',l10n('concours_img_author')); 745 788 } 746 789 */ 747 790 748 791 $query = ' … … 907 950 $template->assign( 'concours_infos', array( 908 951 'name' => $concours['name'], 909 'descr' => $concours['descr'] 952 'descr' => $concours['descr'], 953 'note' => $this->get_img_globalnote_user($page['current_item'], $concours['id']) 910 954 )); 911 955 … … 1446 1490 if ($menu->get_id() != 'menubar' OR $this->my_config['active_menubar'] == false) 1447 1491 return; 1448 $menu->register_block( new RegisteredBlock( 'CONCOURS_menu', ' Polls', 'MYPOLLS'));1492 $menu->register_block( new RegisteredBlock( 'CONCOURS_menu', 'concours', 'ConcoursPhoto')); 1449 1493 } 1450 1494 … … 1546 1590 global $page; 1547 1591 1592 1548 1593 if (isset($page['section']) and $page['section'] == 'concours') 1549 1594 { … … 1553 1598 1554 1599 1600 // Show the global note under the thumbnail 1601 function thumbnail_note($tpl_var) 1602 { 1603 1604 global $page; 1605 $this->get_user_groups(); 1606 1607 if ($this->my_config['thumb_note'] && $this->my_config['thumb_note'] == true) 1608 { 1609 $concours = array(); 1610 if (($page['section']) == 'categories' AND !empty($page['category'])) 1611 { 1612 $query = ' 1613 SELECT * 1614 FROM ' . CONCOURS_TABLE .' 1615 WHERE category =' . $page['category']['id'] . ' 1616 AND time_to_sec(TIMEDIFF(begin_date,now())) < 0 1617 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0 1618 '; 1619 1620 $result = pwg_query($query); 1621 if ($this->debug) echo $query."\n"; 1622 while ($row = mysql_fetch_assoc($result)) 1623 { 1624 1625 if (!empty($row['groups'])) 1626 { 1627 if ($this->debug) echo "GROUPS=".$row['groups']; 1628 $authorized_groups = explode(',', $row['groups']); 1629 if (array_intersect($this->user_groups, $authorized_groups) == array()) 1630 { 1631 if ($this->debug) echo "ERROR GROUPS"; 1632 continue; 1633 } 1634 $concours = $row; 1635 } 1636 } 1637 if (count($concours)) 1638 { 1639 1640 foreach($tpl_var as $cle=>$valeur) { 1641 { 1642 $tpl_var[$cle]['NAME'] = $tpl_var[$cle]['NAME'].'<br> '.l10n('thumbnail_global_note').' : '.$this->get_img_globalnote_user($tpl_var[$cle]['ID'], $concours['id']); 1643 } 1644 } 1645 } 1646 } 1647 } 1648 return $tpl_var; 1649 } 1650 1651 1555 1652 } 1556 1653 -
extensions/ConcoursPhoto/include/default_values.inc.php
r4252 r4260 8 8 $concours_default_values['nbconcours_menubar'] = 3; // Nb of last published concours show on concours menubar 9 9 $concours_default_values['mask_author'] = true; // Mask author for prepared concours 10 $concours_default_values['thumb_note'] = true; // Display global note (for user) under thumbnail 10 11 ?> -
extensions/ConcoursPhoto/language/fr_FR/plugin.lang.php
r4252 r4260 69 69 70 70 $lang['concours_mask_author'] = 'Masquer l\'auteur pour les concours préparés non actifs'; 71 72 $lang['thumbnail_global_note'] = 'Note concours'; 73 $lang['concours_thumb_note'] = 'Ajouter la note globale sous les miniatures'; 74 $lang['concours_global_user_note'] = 'Total enregistré'; 71 75 ?> -
extensions/ConcoursPhoto/main.inc.php
r3905 r4260 58 58 add_event_handler('loc_end_index', array(&$concours, 'index_concours')); 59 59 60 // Add Global note under thumbnail 61 add_event_handler('loc_end_index_thumbnails', array(&$concours, 'thumbnail_note'), 50, 2); 62 60 63 61 64 set_plugin_data($plugin['id'], $concours) -
extensions/ConcoursPhoto/template/concours.tpl
r3905 r4260 5 5 <table> 6 6 <tr> 7 <td align="left" colspan=" 5"><b>Concours : {$concours_infos.name} </b>7 <td align="left" colspan="2"><b>Concours : {$concours_infos.name} </b> 8 8 <i>({$concours_infos.descr})</i> 9 <td> 9 </td> 10 <td align="right" colspan="2"> 11 {'concours_global_user_note'|@translate} : <input type="text" size="4" maxlength="4" name="global_note" value="{$concours_infos.note}" disabled="disabled"/> 12 </td> 13 <td> 14 </td> 10 15 </tr> 11 16 <tr><td colspan="5"><br></td></tr>
Note: See TracChangeset
for help on using the changeset viewer.