Campaign thread
DB
Add the value campaign to the field thread_type to the table thread:
Add the value sms to the field content_type to the table node_content:
Create the table content_sms:
`content_id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`locale` enum('en','fr') NOT NULL DEFAULT 'fr',
`text` text,
PRIMARY KEY (`content_id`,`locale`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Configuration
In the file config.inc, add to thread type campaign to the parameter $supported_threads :
- $supported_threads=array('thread', 'folder', 'story', 'book', 'rss', 'newsletter', 'campaign'); // 'thread', 'folder', 'story', 'book', 'rss', 'newsletter'
Add the description of a sms content to the parameter $contents_model:
- $contents_model = array(
- 'text' => array('text' => array('type' => 'string', 'null' => true), 'eval' => array('type' => 'boolean', 'default' => false)),
- 'infile' => array('path' => array('type' => 'string', 'null' => true)),
- 'download' => array('name' => array('type' => 'string', 'null' => true), 'path' => array('type' => 'string', 'null' => true)),
- 'file' => array('path' => array('type' => 'string', 'null' => true), 'start' => array('type' => 'number', 'default' => 0), 'end' => array('type' => 'number', 'default' => 0), 'format' => array('type' => 'string', 'null' => true), 'lineno' => array('type' => 'boolean', 'default' => true)),
- 'youtube' => array('id' => array('type' => 'string', 'null' => true), 'width' => array('type' => 'number', 'default' => 0), 'height' => array('type' => 'number', 'default' => 0), 'center' => array('type' => 'boolean'), 'miniature' => array('type' => 'string', 'null' => true), 'title' => array('type' => 'string', 'null' => true), 'autoplay' => array('type' => 'boolean')),
- 'sms' => array('text' => array('type' => 'string', 'null' => true)),
- );
Add the type sms to the parameter $supported_contents:
- $supported_contents=array('text', 'infile', 'download', 'file', 'youtube', 'sms'); // 'text', 'infile', 'download', 'file', 'youtube'
Limit the types of contents of the thread type campaign to sms by editing the parameter $limited_contents:
- $limited_contents=array('rss' => array('text'), 'newsletter' => array('text'), 'campaign' => array('sms'));
Code
Add the option campaign after the option newsletter to the selector for the type of thread in the view editing/threadeditsummary in English and in French:
- <?php elseif ($type == 'newsletter'): ?>
- <option value="newsletter"<?php if ($thread_type == 'newsletter'): ?> selected="selected"<?php endif; ?>>Newsletter</option>
- <?php elseif ($type == 'campaign'): ?>
- <option value="campaign"<?php if ($thread_type == 'campaign'): ?> selected="selected"<?php endif; ?>>Campaign</option>
- <?php endif; ?>
- <?php elseif ($type == 'newsletter'): ?>
- <option value="newsletter"<?php if ($thread_type == 'newsletter'): ?> selected="selected"<?php endif; ?>>Infolettre</option>
- <?php elseif ($type == 'campaign'): ?>
- <option value="campaign"<?php if ($thread_type == 'campaign'): ?> selected="selected"<?php endif; ?>>Campagne</option>
- <?php endif; ?>
Add the option campaign after the option newsletter to the selector for the type of thread in the view editing/threadeditall in English and in French:
- <?php elseif ($type == 'newsletter'): ?>
- <option value="newsletter"<?php if ($new_thread_type == 'newsletter'): ?> selected="selected"<?php endif; ?>>Newsletter</option>
- <?php elseif ($type == 'campaign'): ?>
- <option value="campaign"<?php if ($new_thread_type == 'campaign'): ?> selected="selected"<?php endif; ?>>Campaign</option>
- <?php endif; ?>
- <?php elseif ($type == 'newsletter'): ?>
- <option value="newsletter"<?php if ($new_thread_type == 'newsletter'): ?> selected="selected"<?php endif; ?>>Infolettre</option>
- <?php elseif ($type == 'campaign'): ?>
- <option value="campaign"<?php if ($new_thread_type == 'campaign'): ?> selected="selected"<?php endif; ?>>Campagne</option>
- <?php endif; ?>
Add processing a content type sms after the content type youtube in the view editing/nodecontenteditor in English and in French:
- <?php elseif ($type == 'youtube'): ?>
- <option value="youtube" <?php echo $selected == 'youtube' ? 'selected="youtube"' : ''; ?>>YouTube</option>
- <?php elseif ($type == 'sms'): ?>
- <option value="sms" <?php echo $selected == 'sms' ? 'selected="selected"' : ''; ?>>SMS</option>
- <?php endif; ?>
Adds the option sms after the option youtube to the selector for the content type.
- $content_sms_text='';
- extract($c); /* content_id content_number content_ignored content_type ... */
Initializes the variable containing the text of the SMS bebore extracting the data collected by the block nodecontenteditor.
- <?php case 'sms': ?>
- <label>SMS:</label>
- <?php break; ?>
- <?php endswitch; ?>
Displays the label of the content.
- <?php case 'sms': ?>
- <textarea id="content_sms_text_<?php echo $i; ?>" name="content_sms_text[<?php echo $i; ?>]" cols="80" rows="5"><?php if ($content_sms_text): ?><?php echo htmlspecialchars($content_sms_text, ENT_COMPAT, 'UTF-8'); ?><?php endif; ?></textarea>
- <?php break; ?>
- <?php endswitch; ?>
Displays the input field of the text of a SMS.
Adds displaying a content of type sms to the view nodecontent:
- case 'sms':
- $text = $c['text'];
- if ($text) {
- echo '<div class="sms">', PHP_EOL;
- echo '<p>', htmlspecialchars($text, ENT_COMPAT, 'UTF-8'), '</p>', PHP_EOL;
- echo '</div>', PHP_EOL;
- }
- break;
Adds preparing the parameters of the view for a content of type sms in the block nodecontent:
- case 'sms':
- $text=$c['content_sms_text'];
- $contents[] = compact('type', 'text');
- break;
Test
Connect
as an administrator.
Navigate in the editor
to the list of threads.
Add a thread of type Campaign with the title BarFoo.
NOTE: This thread contains all the campaigns managed by a client. In a later chapter, it will be created automatically when a new user is registered.
Edit the thread BarFoo.
Create a content with the title The web engine.
Edit it.
Enter First promotional campaign of iZend for software editors for the abstract and the keywords iZend web engine in the cloud.
Uncheck all the options.
Press Edit.
Add a content of type SMS.
Type Create your multimedia website in a few minutes with iZend - The web engine: https://www.izend.org for the text of the SMS.
a type # or #
contents
Press Modify.
Display
the node.
Create your multimedia website in a few minutes with iZend - The web engine: https://www.izend.org
Click on the keyboard
to go back to editing mode.
Press on the flag
to display the version in French.
Enter the title Le moteur web.
Enter Première campagne de promotion d'iZend auprès des éditeurs de logiciels for the abstract and the keywords iZend moteur web in the cloud.
Press Edit.
Enter Créez votre site multimédias en quelques minutes avec iZend - Le moteur web : https://www.izend.org for the text of the SMS.
Press Modify.
Display
the node.
Créez votre site multimédias en quelques minutes avec iZend - Le moteur web : https://www.izend.org
Git
- /izendsms.com
- blocks
- nodecontent.php
- includes
- config.inc
- views
- nodecontent.phtml
- en
- editing
- nodecontenteditor.phtml
- threadeditall.phtml
- threadeditsummary.phtml
- editing
- fr
- editing
- nodecontenteditor.phtml
- threadeditall.phtml
- threadeditsummary.phtml
- editing
- blocks
Commit this version:
$ git status
$ git add --update
$ git commit -m'Adds thread type campaign'
Comments