Commit edb1ab95 authored by Zot's avatar Zot

Provide examples of even more mid-2016 Hubzilla code constructs within the chords addon

parent acdcd2a7
......@@ -41,24 +41,18 @@ class Chords extends \Zotlabs\Web\Controller {
$chords .= '</pre>';
}
$text .= <<< EOT
<p class="descriptive-text">
This is a fairly comprehensive and complete guitar chord dictionary which will list most of the available ways to play a certain chord, starting from the base of the fingerboard up to a few frets beyond the twelfth fret (beyond which everything repeats). A couple of non-standard tunings are provided for the benefit of slide players, etc.
<p />
<p class="descriptive-text">
Chord names start with a root note (A-G) and may include sharps (#) and flats (b). This software will parse most of the standard naming conventions such as maj, min, dim, sus(2 or 4), aug, with optional repeating elements.
</p>
<p class="descriptive-text">
Valid examples include A, A7, Am7, Amaj7, Amaj9, Ammaj7, Aadd4, Asus2Add4, E7b13b11 ...
</p>
EOT;
$p1 = t('This is a fairly comprehensive and complete guitar chord dictionary which will list most of the available ways to play a certain chord, starting from the base of the fingerboard up to a few frets beyond the twelfth fret (beyond which everything repeats). A couple of non-standard tunings are provided for the benefit of slide players, etc.');
$p2 = t('Chord names start with a root note (A-G) and may include sharps (#) and flats (b). This software will parse most of the standard naming conventions such as maj, min, dim, sus(2 or 4), aug, with optional repeating elements.');
$p3 = t('Valid examples include A, A7, Am7, Amaj7, Amaj9, Ammaj7, Aadd4, Asus2Add4, E7b13b11 ...');
$o .= replace_macros(get_markup_template('chords.tpl','addon/chords'), [
'$header' => t('Guitar Chords'),
'$desc' => t('The complete online chord dictionary'),
'$text' => $text,
'$p1' => $p1,
'$p2' => $p2,
'$p3' => $p3,
'$chords' => $chords,
'$tuning' => [ 'tuning', t('Tuning'), $_POST['tuning'], '', $tunings ],
'$chord' => [ 'chord', t('Chord name: example: Em7'), $_REQUEST['chord'], '' ],
......
......@@ -11,7 +11,7 @@
require_once('addon/chords/Mod_Chords.php');
function chords_load() {
Zotlabs\Extend\Hook::register('load_pdl', 'addon/chords/chords.php', 'chords_pdl');
Zotlabs\Extend\Hook::register('load_pdl', 'addon/chords/chords.php', '\\Chords::chords_pdl');
}
function chords_unload() {
......@@ -19,9 +19,11 @@ function chords_unload() {
}
function chords_pdl(&$x) {
if($x['module'] === 'chords')
$x['layout'] = '[region=aside][widget=chords][/widget][/region]';
class Chords {
static public function chords_pdl(&$x) {
if($x['module'] === 'chords')
$x['layout'] = '[region=aside][widget=chords][/widget][/region]';
}
}
function widget_chords($args) {
......
......@@ -3,15 +3,18 @@
<div>{{$desc}}</div>
<br />
{{$text}}
<p class="descriptive-text">{{$p1}}</p>
<p class="descriptive-text">{{$p2}}</p>
<p class="descriptive-text">{{$p3}}</p>
<br />
<form action="chords" method="post">
{{include file="field_input.tpl" field=$chord}}
{{include file="field_select.tpl" field=$tuning}}
{{include file="field_checkbox.tpl" field=$lefty}}
<input type="submit" name="submit" value={{$submit}} />
{{include file="field_input.tpl" field=$chord}}
{{include file="field_select.tpl" field=$tuning}}
{{include file="field_checkbox.tpl" field=$lefty}}
<input type="submit" name="submit" value={{$submit}} />
</form>
<br /><br />
{{$chords}}
<br />
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment