Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5abf561
commit 3834f43
Showing
24 changed files
with
1,186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
<?php if (!defined('NEOFRAG_CMS')) exit; | ||
/************************************************************************** | ||
Copyright © 2015 Michaël BILCOT & Jérémy VALENTIN | ||
This file is part of NeoFrag. | ||
NeoFrag is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
NeoFrag 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 Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with NeoFrag. If not, see <http://www.gnu.org/licenses/>. | ||
**************************************************************************/ | ||
|
||
class m_partners_c_admin extends Controller_Module | ||
{ | ||
public function index() | ||
{ | ||
$this->load ->library('table') | ||
->add_columns(array( | ||
array( | ||
'content' => function($data){ | ||
return button_sort($data['partner_id'], 'admin/ajax/partners/sort.html'); | ||
}, | ||
'size' => TRUE | ||
), | ||
array( | ||
'title' => 'Nom', | ||
'content' => function($data){ | ||
return $data['title']; | ||
} | ||
), | ||
array( | ||
'title' => 'Site internet', | ||
'content' => function($data){ | ||
return '<a href="'.$data['website'].'" target="_blank">'.$data['website'].'</a>'; | ||
} | ||
), | ||
array( | ||
'title' => '<span data-toggle="tooltip" title="Visites">'.icon('fa-line-chart').'</span>', | ||
'content' => function($data){ | ||
return $data['count']; | ||
} | ||
), | ||
array( | ||
'content' => array( | ||
function($data){ | ||
return button_edit('admin/partners/'.$data['partner_id'].'/'.$data['name'].'.html'); | ||
}, | ||
function($data){ | ||
return button_delete('admin/partners/delete/'.$data['partner_id'].'/'.$data['name'].'.html'); | ||
} | ||
), | ||
'size' => TRUE | ||
) | ||
)) | ||
->data($this->model()->get_partners()) | ||
->no_data('Aucun partenaire'); | ||
|
||
return new Panel(array( | ||
'title' => 'Liste des partenaires', | ||
'icon' => 'fa-star-o', | ||
'content' => $this->table->display(), | ||
'footer' => button_add('admin/partners/add.html', 'Ajouter un partenaire') | ||
)); | ||
} | ||
|
||
public function add() | ||
{ | ||
$this ->subtitle('Ajouter un partenaire') | ||
->load->library('form') | ||
->add_rules('partners') | ||
->add_submit($this('add')) | ||
->add_back('admin/partners.html'); | ||
|
||
if ($this->form->is_valid($post)) | ||
{ | ||
$this->model()->add_partner($post['title'], | ||
$post['logo_light'], | ||
$post['logo_dark'], | ||
$post['description'], | ||
$post['website'], | ||
$post['facebook'], | ||
$post['twitter'], | ||
$post['code']); | ||
|
||
//add_alert('success', $this('add_partner_success_message')); | ||
|
||
redirect('admin/partners.html'); | ||
} | ||
|
||
return new Panel(array( | ||
'title' => 'Ajouter un partenaire', | ||
'icon' => 'fa-star-o', | ||
'content' => $this->form->display() | ||
)); | ||
} | ||
|
||
public function _edit($partner_id, $name, $logo_light, $logo_dark, $website, $facebook, $twitter, $count, $code, $title, $description) | ||
{ | ||
$this ->subtitle($title) | ||
->load->library('form') | ||
->add_rules('partners', array( | ||
'title' => $title, | ||
'logo_light' => $logo_light, | ||
'logo_dark' => $logo_dark, | ||
'description' => $description, | ||
'website' => $website, | ||
'facebook' => $facebook, | ||
'twitter' => $twitter, | ||
'code' => $code | ||
)) | ||
->add_submit($this('edit')) | ||
->add_back('admin/partners.html'); | ||
|
||
if ($this->form->is_valid($post)) | ||
{ | ||
$this->model()->edit_partner( $partner_id, | ||
$post['title'], | ||
$post['logo_light'], | ||
$post['logo_dark'], | ||
$post['description'], | ||
$post['website'], | ||
$post['facebook'], | ||
$post['twitter'], | ||
$post['code']); | ||
|
||
//add_alert('success', $this('edit_partner_success_message')); | ||
|
||
redirect_back('admin/partners.html'); | ||
} | ||
|
||
return new Panel(array( | ||
'title' => 'Éditer le partenaire', | ||
'icon' => 'fa-star-o', | ||
'content' => $this->form->display() | ||
)); | ||
} | ||
|
||
public function delete($partner_id, $title) | ||
{ | ||
$this ->title('Supprimer le partenaire') | ||
->subtitle($title) | ||
->load->library('form') | ||
->confirm_deletion($this('delete_confirmation'), 'Êtes-vous sûr(e) de vouloir supprimer le partenaire <b>'.$title.'</b> ?'); | ||
|
||
if ($this->form->is_valid()) | ||
{ | ||
$this->model()->delete_partner($partner_id); | ||
|
||
return 'OK'; | ||
} | ||
|
||
echo $this->form->display(); | ||
} | ||
} | ||
|
||
/* | ||
NeoFrag Alpha 0.1.4 | ||
./modules/partners/controllers/admin.php | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php if (!defined('NEOFRAG_CMS')) exit; | ||
/************************************************************************** | ||
Copyright © 2015 Michaël BILCOT & Jérémy VALENTIN | ||
This file is part of NeoFrag. | ||
NeoFrag is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
NeoFrag 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 Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with NeoFrag. If not, see <http://www.gnu.org/licenses/>. | ||
**************************************************************************/ | ||
|
||
class m_partners_c_admin_ajax extends Controller | ||
{ | ||
public function sort($partner_id, $position) | ||
{ | ||
$partners = array(); | ||
|
||
foreach ($this->db->select('partner_id')->from('nf_partners')->where('partner_id !=', $partner_id)->order_by('order', 'partner_id')->get() as $partner) | ||
{ | ||
$partners[] = $partner; | ||
} | ||
|
||
foreach (array_merge(array_slice($partners, 0, $position, TRUE), array($partner_id), array_slice($partners, $position, NULL, TRUE)) as $order => $partner_id) | ||
{ | ||
$this->db ->where('partner_id', $partner_id) | ||
->update('nf_partners', array( | ||
'order' => $order | ||
)); | ||
} | ||
} | ||
} | ||
|
||
/* | ||
NeoFrag Alpha 0.1.4 | ||
./modules/partners/controllers/admin_ajax.php | ||
*/ |
Oops, something went wrong.