CMS  Version 3.9
contact_topics.inc File Reference

Go to the source code of this file.

Functions

 formatSortOrderInputField ($contactTopic)
 
 formatSiteList ($contactTopic)
 
 reorderContactTopics ()
 

Variables

 $menu_item = "Contact Topics"
 
 $title = "Contact Topics"
 
 $topics = query(ContactTopic, "ORDER BY sort_order")
 
 $table = new DataListView($topics, "contactTopics")
 
 $sites = query(Site)
 
$table emptyMessage = "There are no contact topics defined."
 
$table sortable = false
 
$table cssStyle = "width: 100%"
 
$table dragText = "<span style='font-size: 10px'>Click and drag to reorder contact topics</span>"
 
if($method=="POST") $script = $table->writeScript()
 

Function Documentation

◆ formatSiteList()

formatSiteList (   $contactTopic)

Definition at line 96 of file contact_topics.inc.

97 {
98  $sites = $contactTopic->Sites();
99  return formatItems($sites, "{site_name}", "<br>");
100 }
$sites

◆ formatSortOrderInputField()

formatSortOrderInputField (   $contactTopic)

Definition at line 89 of file contact_topics.inc.

90 {
91  return "<input type='text' name='contact_topic_{$contactTopic->contact_topic_id}'
92  value='{$contactTopic->sort_order}' size='4'/>";
93 
94 }

◆ reorderContactTopics()

reorderContactTopics ( )

Definition at line 102 of file contact_topics.inc.

103 {
104  global $_POST;
105  // reorder
106  foreach($_POST as $name => $value)
107  {
108  if (!strncmp($name, "contact_topic_", 14))
109  {
110  $id = substr($name, 14);
111  $contactTopic = new ContactTopic();
112  $contactTopic->filter = new InclusionFilter("contact_topic_id", "sort_order");
113  $contactTopic->contact_topic_id = $id;
114  $contactTopic->sort_order = $value;
115  $contactTopic->save();
116  }
117  }
118  // renumber
119  $contactTopics = query(ContactTopic, "ORDER BY sort_order");
120  $value = 1;
121 
122  foreach($contactTopics as $contactTopic)
123  {
124  $contactTopic->filter = new InclusionFilter("sort_order");
125  $contactTopic->sort_order = $value;
126  $contactTopic->save();
127  $value++;
128  } // end reOrder
129 }
$_POST["owner_id"]
Definition: blog_form.inc:54
$name
Definition: upload.inc:54

Variable Documentation

◆ $menu_item

$menu_item = "Contact Topics"

Definition at line 47 of file contact_topics.inc.

◆ $script

if ( $method=="POST") $script = $table->writeScript()

Definition at line 76 of file contact_topics.inc.

◆ $sites

$sites = query(Site)

Definition at line 58 of file contact_topics.inc.

◆ $table

$table = new DataListView($topics, "contactTopics")

Definition at line 53 of file contact_topics.inc.

◆ $title

$title = "Contact Topics"

Definition at line 49 of file contact_topics.inc.

◆ $topics

$topics = query(ContactTopic, "ORDER BY sort_order")

Definition at line 51 of file contact_topics.inc.

◆ cssStyle

$table cssStyle = "width: 100%"

Definition at line 64 of file contact_topics.inc.

◆ dragText

$table dragText = "<span style='font-size: 10px'>Click and drag to reorder contact topics</span>"

Definition at line 66 of file contact_topics.inc.

◆ emptyMessage

$table emptyMessage = "There are no contact topics defined."

Definition at line 62 of file contact_topics.inc.

◆ sortable

$table sortable = false

Definition at line 63 of file contact_topics.inc.