Skip to content
This repository has been archived by the owner on Aug 5, 2018. It is now read-only.

Commit

Permalink
Implement a possibility to hide squads in squads/list and member list…
Browse files Browse the repository at this point in the history
…s (see topic 18914)
  • Loading branch information
Eike Broda committed Mar 29, 2015
1 parent abb51f7 commit 3f99ca2
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 17 deletions.
1 change: 1 addition & 0 deletions install.sql
Expand Up @@ -1080,6 +1080,7 @@ CREATE TABLE {pre}_squads (
squads_own int(2) NOT NULL default '0',
squads_joinus int(2) NOT NULL default '0',
squads_fightus int(2) NOT NULL default '0',
squads_hidden int(2) NOT NULL default '0',
squads_text text,
PRIMARY KEY (squads_id),
UNIQUE (squads_name)
Expand Down
1 change: 1 addition & 0 deletions lang/English/squads.php
Expand Up @@ -103,6 +103,7 @@
$cs_lang['hidden'] = 'hide';
$cs_lang['joinus'] = 'joinus';
$cs_lang['fightus'] = 'fightus and wars';
$cs_lang['squads_members'] = 'squads and members';

$cs_lang['pic_infos'] = 'Informationbox';
$cs_lang['max_width'] = 'Maximum width: ';
Expand Down
1 change: 1 addition & 0 deletions lang/German/squads.php
Expand Up @@ -103,6 +103,7 @@
$cs_lang['hidden'] = 'Verstecken';
$cs_lang['joinus'] = 'JoinUs';
$cs_lang['fightus'] = 'FightUs und Wars';
$cs_lang['squads_members'] = 'Squads/Mitglieder';

$cs_lang['pic_infos'] = 'Infobox';
$cs_lang['max_width'] = 'Maximale Breite: ';
Expand Down
3 changes: 2 additions & 1 deletion mods/members/list.php
Expand Up @@ -11,7 +11,8 @@
$cells = 'sq.squads_id AS squads_id, sq.games_id AS games_id, sq.squads_name AS squads_name, ';
$cells .= 'sq.clans_id AS clans_id, cln.clans_tagpos AS clans_tagpos, sq.squads_text AS squads_text, ';
$cells .= 'cln.clans_tag AS clans_tag, sq.squads_picture AS squads_picture';
$cs_squads = cs_sql_select(__FILE__,$tables,$cells,'squads_own = \'1\'','squads_order, squads_name',0,0);
$where = 'squads_own = \'1\' AND squads_hidden = 0';
$cs_squads = cs_sql_select(__FILE__,$tables,$cells,$where,'squads_order, squads_name',0,0);

$squads_loop = count($cs_squads);
$members_count = cs_sql_count(__FILE__,'members',0,'users_id');
Expand Down
3 changes: 2 additions & 1 deletion mods/members/pictured.php
Expand Up @@ -12,7 +12,8 @@
$cells = 'sq.squads_id AS squads_id, sq.games_id AS games_id, sq.squads_name AS squads_name, ';
$cells .= 'sq.clans_id AS clans_id, cln.clans_tagpos AS clans_tagpos, ';
$cells .= 'cln.clans_tag AS clans_tag';
$data['squads'] = cs_sql_select(__FILE__,$tables,$cells,'squads_own = \'1\'','squads_order, squads_name',0,0);
$where = 'squads_own = \'1\' AND squads_hidden = 0';
$data['squads'] = cs_sql_select(__FILE__,$tables,$cells,$where,'squads_order, squads_name',0,0);
$squads_loop = count($data['squads']);

$data['head']['mod'] = $cs_lang[$op_members['label']];
Expand Down
3 changes: 2 additions & 1 deletion mods/members/teams.php
Expand Up @@ -8,7 +8,8 @@
$op_members = cs_sql_option(__FILE__,'members');

$squads_order = 'squads_order, squads_name';
$cs_squads = cs_sql_select(__FILE__,'squads','*','squads_own = \'1\'',$squads_order,0,0);
$where = 'squads_own = \'1\' AND squads_hidden = 0';
$cs_squads = cs_sql_select(__FILE__,'squads','*',$where,$squads_order,0,0);
$squads_loop = count($cs_squads);

$data['lang']['mod_name'] = $cs_lang[$op_members['label']];
Expand Down
7 changes: 5 additions & 2 deletions mods/squads/create.php
Expand Up @@ -24,6 +24,7 @@
$cs_squads['squads_pwd'] = $_POST['squads_pwd'];
$cs_squads['squads_fightus'] = empty($_POST['squads_fightus']) ? 0 : 1;
$cs_squads['squads_joinus'] = empty($_POST['squads_joinus']) ? 0 : 1;
$cs_squads['squads_hidden'] = empty($_POST['squads_hidden']) ? 0 : 1;
$cs_squads['squads_text'] = $_POST['squads_text'];

$error = '';
Expand Down Expand Up @@ -75,6 +76,7 @@
$cs_squads['squads_pwd'] = '';
$cs_squads['squads_fightus'] = 0;
$cs_squads['squads_joinus'] = 0;
$cs_squads['squads_hidden'] = 0;
$cs_squads['squads_text'] = '';
}

Expand All @@ -98,8 +100,9 @@
$checked = 'checked="checked"';
$data['squads']['own_check'] = empty($cs_squads['squads_own']) ? '' : $checked;

$data['squads']['joinus_check'] = empty($cs_squads['squads_joinus']) ? '' : $checked ;
$data['squads']['fightus_check'] = empty($cs_squads['squads_fightus']) ? '' : $checked ;
$data['squads']['joinus_check'] = empty($cs_squads['squads_joinus']) ? '' : $checked ;
$data['squads']['fightus_check'] = empty($cs_squads['squads_fightus']) ? '' : $checked ;
$data['squads']['squads_check'] = empty($cs_squads['squads_hidden']) ? '' : $checked;

$data['lang']['clan_label'] = $cs_lang[$op_clans['label']];
$cs_clans = cs_sql_select(__FILE__,'clans','clans_name,clans_id',0,'clans_name',0,0);
Expand Down
11 changes: 7 additions & 4 deletions mods/squads/edit.php
Expand Up @@ -21,7 +21,7 @@
$img_filetypes = array('gif','jpg','png');

$cells = 'squads_id, clans_id, games_id, squads_name, squads_order, squads_pwd, squads_picture, ';
$cells .= 'squads_own, squads_joinus, squads_fightus, squads_text';
$cells .= 'squads_own, squads_joinus, squads_fightus, squads_text, squads_hidden';
$cs_squads = cs_sql_select(__FILE__,'squads',$cells,'squads_id = "' . $squads_id . '"');


Expand All @@ -36,6 +36,7 @@
$cs_squads['squads_picture'] = $_POST['squads_picture'];
$cs_squads['squads_fightus'] = empty($_POST['squads_fightus']) ? 0 : 1;
$cs_squads['squads_joinus'] = empty($_POST['squads_joinus']) ? 0 : 1;
$cs_squads['squads_hidden'] = empty($_POST['squads_hidden']) ? 0 : 1;
$cs_squads['squads_text'] = $_POST['squads_text'];

$error = '';
Expand Down Expand Up @@ -120,9 +121,11 @@
$data['lang']['own_label'] = $cs_lang['own_'.$op_clans['label']];
$checked = 'checked="checked"';
$data['squads']['own_check'] = empty($cs_squads['squads_own']) ? '' : $checked;

$data['squads']['joinus_check'] = empty($cs_squads['squads_joinus']) ? '' : $checked ;
$data['squads']['fightus_check'] = empty($cs_squads['squads_fightus']) ? '' : $checked ;

$data['squads']['joinus_check'] = empty($cs_squads['squads_joinus']) ? '' : $checked ;
$data['squads']['fightus_check'] = empty($cs_squads['squads_fightus']) ? '' : $checked ;
$data['squads']['hidden_check'] = empty($cs_squads['squads_hidden']) ? '' : $checked ;


$data['lang']['clan_label'] = $cs_lang[$op_clans['label']];
$cs_clans = cs_sql_select(__FILE__,'clans','clans_name,clans_id',0,'clans_name',0,0);
Expand Down
11 changes: 5 additions & 6 deletions mods/squads/list.php
Expand Up @@ -20,7 +20,8 @@
$cs_sort[3] = 'cln.clans_name DESC';
$cs_sort[4] = 'cln.clans_name ASC';
$order = $cs_sort[$sort];
$squads_count = cs_sql_count(__FILE__,'squads');
$where = 'squads_hidden = 0';
$squads_count = cs_sql_count(__FILE__,'squads', $where);


$data['head']['mod'] = $cs_lang[$op_squads['label'].'s'];
Expand All @@ -35,7 +36,7 @@
$select = 'sqd.squads_name AS squads_name, sqd.clans_id AS clans_id, cln.clans_name AS ';
$select .= 'clans_name, sqd.squads_id AS squads_id, sqd.games_id AS games_id';
$from = 'squads sqd INNER JOIN {pre}_clans cln ON sqd.clans_id = cln.clans_id';
$data['squads'] = cs_sql_select(__FILE__,$from,$select,0,$order,$start,$account['users_limit']);
$data['squads'] = cs_sql_select(__FILE__,$from,$select,$where,$order,$start,$account['users_limit']);
$squads_loop = count($data['squads']);


Expand All @@ -45,10 +46,8 @@
if(file_exists('uploads/games/' . $data['squads'][$run]['games_id'] . '.gif')) {
$data['squads'][$run]['games_img'] = cs_html_img('uploads/games/' . $data['squads'][$run]['games_id'] . '.gif');
}
$data['squads'][$run]['squads_name'] = cs_secure($data['squads'][$run]['squads_name']);
$data['squads'][$run]['clans_name'] = cs_secure($data['squads'][$run]['clans_name']);
$data['squads'][$run]['squads_name'] = cs_secure($data['squads'][$run]['squads_name']);
$data['squads'][$run]['clans_name'] = cs_secure($data['squads'][$run]['clans_name']);
$data['squads'][$run]['id'] = $data['squads'][$run]['squads_id'];
$data['squads'][$run]['clans_id'] = $data['squads'][$run]['clans_id'];

}
echo cs_subtemplate(__FILE__,$data,'squads','list');
3 changes: 2 additions & 1 deletion themes/base/squads/create.tpl
Expand Up @@ -22,7 +22,8 @@
<td class="leftc">{icon:lock} {lang:hidden}</td>
<td class="leftb">
<input type="checkbox" name="squads_joinus" value="joinus" {squads:joinus_check} /> {lang:joinus}<br />
<input type="checkbox" name="squads_fightus" value="fightus" {squads:fightus_check} /> {lang:fightus}
<input type="checkbox" name="squads_fightus" value="fightus" {squads:fightus_check} /> {lang:fightus} <br />
<input type="checkbox" name="squads_hidden" value="hidden" {squads:hidden_check} /> {lang:squads_members}
</td>
</tr>
<tr>
Expand Down
3 changes: 2 additions & 1 deletion themes/base/squads/edit.tpl
Expand Up @@ -22,7 +22,8 @@
<td class="leftc">{icon:lock} {lang:hidden}</td>
<td class="leftb">
<input type="checkbox" name="squads_joinus" value="joinus" {squads:joinus_check} /> {lang:joinus}<br />
<input type="checkbox" name="squads_fightus" value="fightus" {squads:fightus_check} /> {lang:fightus}
<input type="checkbox" name="squads_fightus" value="fightus" {squads:fightus_check} /> {lang:fightus} <br />
<input type="checkbox" name="squads_hidden" value="hidden" {squads:hidden_check} /> {lang:squads_members}
</td>
</tr>
<tr>
Expand Down
5 changes: 5 additions & 0 deletions updates/nr47_2011.4.5_to_2011.4.6.sql
@@ -0,0 +1,5 @@
UPDATE {pre}_options SET options_value = '2011.4.6' WHERE options_mod = 'clansphere' AND options_name = 'version_name';
UPDATE {pre}_options SET options_value = '2015-xx-xx' WHERE options_mod = 'clansphere' AND options_name = 'version_date';
UPDATE {pre}_options SET options_value = '98' WHERE options_mod = 'clansphere' AND options_name = 'version_id';

ALTER TABLE {pre}_squads ADD squads_hidden int(2) NOT NULL default '0';

0 comments on commit 3f99ca2

Please sign in to comment.