Changeset 678
- Timestamp:
- Jul 26, 2014, 11:15:46 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r677 r678 1 1 <?php 2 2 3 $Revision = 67 7; // Subversion revision4 $DatabaseRevision = 67 6; // SQL structure revision3 $Revision = 678; // Subversion revision 4 $DatabaseRevision = 678; // SQL structure revision 5 5 $ReleaseTime = strtotime('2014-07-25'); -
trunk/Common/Setup/Updates.php
r677 r678 848 848 } 849 849 850 function UpdateTo678($Manager) 851 { 852 $Manager->Execute('ALTER TABLE `Contact` ADD `Description` VARCHAR( 255 ) NOT NULL ;'); 853 $Manager->Execute('ALTER TABLE `Contact` ADD `Receive` BOOLEAN NOT NULL ;'); 854 855 $Manager->Execute('CREATE TABLE IF NOT EXISTS `MenuItemFavorite` ( 856 `Id` int(11) NOT NULL AUTO_INCREMENT, 857 `User` int(11) NOT NULL, 858 `MenuItem` int(11) NOT NULL, 859 PRIMARY KEY (`Id`), 860 KEY `User` (`User`), 861 KEY `MenuItem` (`MenuItem`) 862 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 863 864 $Manager->Execute('ALTER TABLE `MenuItemFavorite` 865 ADD CONSTRAINT `MenuItemFavorite_ibfk_2` FOREIGN KEY (`MenuItem`) REFERENCES `MenuItem` (`Id`), 866 ADD CONSTRAINT `MenuItemFavorite_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`);'); 867 868 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 869 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 870 NULL , "", "Oblíbené položky nabídky", "1", "/is/?t=MenuItemFavorite&a=list", NULL , NULL , NULL , "1");'); 871 $ActionId = $Manager->Database->insert_id; 872 $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Nabídky"'); 873 if($DbResult->num_rows > 0) 874 { 875 $DbRow = $DbResult->fetch_assoc(); 876 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 877 "VALUES (NULL , 'Oblíbené položky nabídky', ".$DbRow['Id'].", '".$ActionId."', '1');"); 878 } 879 } 880 850 881 class Updates 851 882 { … … 894 925 671 => array('Revision' => 674, 'Function' => 'UpdateTo674'), 895 926 674 => array('Revision' => 676, 'Function' => 'UpdateTo676'), 927 676 => array('Revision' => 678, 'Function' => 'UpdateTo678'), 896 928 )); 897 929 } -
trunk/Modules/IS/IS.php
r665 r678 23 23 if(array_key_exists('i', $_GET)) $ItemId = $_GET['i']; 24 24 else $ItemId = 0; 25 if(array_key_exists('menutype', $_COOKIE)) $MenuType = $_COOKIE['menutype']; 26 else $MenuType = 0; 27 if(array_key_exists('menutype', $_GET)) $MenuType = $_GET['menutype'] * 1; 28 setcookie('menutype', $MenuType, time() + 60 * 60 * 24 * 365); 25 29 26 30 if($Action == 'list') $Content = $this->ShowList($Table); … … 32 36 else if($Action == 'view') $Content = $this->ShowView($Table, $ItemId); 33 37 else if($Action == 'delete') $Content = $this->ShowDelete($Table, $ItemId); 38 else if($Action == 'fav_add') $Content = $this->ShowFavoriteAdd($Table, $ItemId); 39 else if($Action == 'fav_del') $Content = $this->ShowFavoriteDel($Table, $ItemId); 34 40 else $Content = $this->Dashboard(); 35 41 if($this->HideMenu == false) 36 42 { 37 43 $Output = '<table style="width: 100%"><tr><td style="width: 20%; vertical-align: top;">'; 38 $Output .= '<strong>Nabídka:</strong>'.$this->ShowMenu(); 44 $MenuTypeText = '<a href="?menutype=0">Nabídka</a>'; 45 if($MenuType == 0) $MenuTypeText = '<strong>'.$MenuTypeText.'</strong>'; 46 $Output .= $MenuTypeText.' '; 47 $MenuTypeText = '<a href="?menutype=1">Oblíbené</a>'; 48 if($MenuType == 1) $MenuTypeText = '<strong>'.$MenuTypeText.'</strong>'; 49 $Output .= $MenuTypeText.' '; 50 if($MenuType == 0) $Output .= $this->ShowMenu(); 51 if($MenuType == 1) $Output .= $this->ShowFavorites(); 39 52 $Output .= '</td><td style="width: 80%; vertical-align: top;">'; 40 53 $Output .= $Content; … … 69 82 $DbRow = $DbResult->fetch_row(); 70 83 $Output .= 'Nezpárovaných plateb: '.$DbRow['0'].'<br/>'; 84 return($Output); 85 } 86 87 function ShowFavoriteAdd($Table, $ItemId) 88 { 89 $DbResult = $this->Database->select('MenuItemFavorite', 'Id', '(`MenuItem`='.($_GET['i'] * 1).') AND (`User`='.$this->System->User->User['Id'].')'); 90 if($DbResult->num_rows > 0) 91 { 92 $Output = $this->SystemMessage('Oblíbené', 'Již existuje v oblíbených'); 93 } else { 94 $this->Database->insert('MenuItemFavorite', array('MenuItem' => ($_GET['i'] * 1), 'User' => $this->System->User->User['Id'])); 95 $Output = $this->SystemMessage('Oblíbené', 'Přidáno do oblíbených'); 96 } 97 $Output .= $this->ShowList($Table); 98 return($Output); 99 } 100 101 function ShowFavoriteDel($Table, $ItemId) 102 { 103 $DbResult = $this->Database->select('MenuItemFavorite', 'Id', '(`MenuItem`='.($_GET['i'] * 1).') AND (`User`='.$this->System->User->User['Id'].')'); 104 if($DbResult->num_rows > 0) 105 { 106 $DbRow = $DbResult->fetch_assoc(); 107 $this->Database->delete('MenuItemFavorite', '`Id`= '.$DbRow['Id']); 108 $Output = $this->SystemMessage('Oblíbené', 'Odstraněno z oblíbených'); 109 } else { 110 $Output = $this->SystemMessage('Oblíbené', 'Nenalezeno v oblíbených'); 111 } 112 $Output .= $this->ShowList($Table); 71 113 return($Output); 72 114 } … … 535 577 $Output .= '<li><a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 536 578 $this->System->Link('/images/list.png').'"/>Seznam</a></li>'; 579 $MI = 0; 580 if(array_key_exists('mi', $_GET)) 581 { 582 $DbResult = $this->Database->select('MenuItemFavorite', 'Id', '(`MenuItem`='.($_GET['mi'] * 1).') AND (`User`='.$this->System->User->User['Id'].')'); 583 if($DbResult->num_rows > 0) 584 { 585 $DbRow = $DbResult->fetch_assoc(); 586 $Fav = $DbRow['Id']; 587 $Output .= '<li><a href="?a=fav_del&t='.$Table.'&i='.$_GET['mi'].'&mi='.$_GET['mi'].'"><img alt="Odebrat z oblíbených" title="Odebrat z oblíbených" src="'. 588 $this->System->Link('/images/Favorite-Del.png').'"/>Odebrat z oblíbených</a></li>'; 589 } else $Output .= '<li><a href="?a=fav_add&t='.$Table.'&i='.$_GET['mi'].'&mi='.$_GET['mi'].'"><img alt="Přidat do oblíbených" title="Přidat do oblíbených" src="'. 590 $this->System->Link('/images/Favorite-Add.png').'"/>Přidat do oblíbených</a></li>'; 591 } 537 592 if(array_key_exists('Actions', $FormClass)) 538 593 { … … 543 598 $Output .= '</ul>'; 544 599 return($Output); 600 } 601 602 function ShowFavorites() 603 { 604 $this->MenuItems = array(); 605 $DbResult = $this->Database->query('SELECT `MenuItem`.`Id`, `MenuItem`.`Name`, `MenuItem`.`Parent`, `Action`.`URL` AS `URL`, `ActionIcon`.`Name` AS `IconName`, `Action`.`PermissionOperation` AS `Permission` FROM `MenuItemFavorite` ' . 606 'LEFT JOIN `MenuItem` ON `MenuItem`.`Id` = `MenuItemFavorite`.`MenuItem` '. 607 'LEFT JOIN `Action` ON `Action`.`Id` = `MenuItem`.`Action` '. 608 'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '. 609 'WHERE `MenuItemFavorite`.`User`='.$this->System->User->User['Id'].' '. 610 'ORDER BY `MenuItem`.`Parent`,`MenuItem`.`Name`'); 611 while($DbRow = $DbResult->fetch_assoc()) 612 { 613 //if($DbRow['Permission'] != '') 614 $this->MenuItems[$DbRow['Id']] = $DbRow; 615 } 616 return($this->ShowMenuItem('', true)); 545 617 } 546 618 … … 561 633 } 562 634 563 function ShowMenuItem($Parent )635 function ShowMenuItem($Parent, $All = false) 564 636 { 565 637 $Output = '<ul style="list-style: none; margin-left:1em; padding-left:0em;">'; 566 638 foreach($this->MenuItems as $MenuItem) 567 if( $MenuItem['Parent'] == $Parent)639 if(($MenuItem['Parent'] == $Parent) or $All) 568 640 { 569 641 $LinkTitle = $MenuItem['Name']; … … 572 644 $Icon = 'Device.png'; 573 645 if(substr($MenuItem['URL'], 0, 4) != 'http') $MenuItem['URL'] = $this->System->Link($MenuItem['URL']); 574 $LinkTitle = MakeLink($MenuItem['URL'] , $LinkTitle);646 $LinkTitle = MakeLink($MenuItem['URL'].'&mi='.$MenuItem['Id'], $LinkTitle); 575 647 } else $Icon = 'Folder.png'; 576 648 if($MenuItem['IconName'] != '') $Image = '<img src="'.$this->System->Link('/images/favicons/'.$MenuItem['IconName']).'"/> '; … … 578 650 //if($this->System->User->CheckPermission($this->TableToModule($Table), 'Write') or !defined('NEW_PERMISSION')) 579 651 $Output .= '<li>'.$Image.$LinkTitle.'</li>'; 580 $Output .= $this->ShowMenuItem($MenuItem['Id']);652 if($All == false) $Output .= $this->ShowMenuItem($MenuItem['Id']); 581 653 } 582 654 $Output .= '</ul>'; … … 631 703 ), 632 704 )); 705 $this->System->FormManager->RegisterClass('MenuItemFavorite', array( 706 'Title' => 'Oblíbené položky nabídky', 707 'Table' => 'MenuItemFavorite', 708 'Items' => array( 709 'User' => array('Type' => 'TUser', 'Caption' => 'Uživatele', 'Default' => '0'), 710 'MenuItem' => array('Type' => 'TMenuItem', 'Caption' => 'Položka nabídky', 'Default' => '0'), 711 ), 712 )); 633 713 $this->System->FormManager->RegisterClass('Menu', array( 634 714 'Title' => 'Nabídky', -
trunk/Modules/Subject/Subject.php
r662 r678 88 88 'User' => array('Type' => 'TUser', 'Caption' => 'Uživatel', 'Default' => '', 'Null' => true), 89 89 'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subject', 'Default' => '', 'Null' => true), 90 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''), 91 'Receive' => array('Type' => 'Boolean', 'Caption' => 'Přijímat zprávy', 'Default' => '0'), 90 92 ), 91 93 ));
Note:
See TracChangeset
for help on using the changeset viewer.