Exemple #1
0
 function form_build_field($field, $html_type = NULL, $data = NULL, $extra = '')
 {
     $field_name = $field['field'];
     $field_type = $field['type'];
     $field_value = $field['value'];
     $extra = $extra . ' id="' . $field_name . '"';
     // Define the HTML type to use from DB field
     // Limited, as the DB types cannot be translated to HTML form types
     if (is_null($html_type)) {
         switch ($field_type) {
             case 'tinyint':
             case 'smallint':
                 // Checkbox (on / off)
                 if ($field['length'] == 1) {
                     $html_type = "checkbox";
                 } else {
                     $html_type = "input";
                 }
                 break;
             case 'float':
             case 'int':
             case 'char':
             case 'tinytext':
                 $html_type = "input";
                 break;
             case 'varchar':
             case 'text':
             case 'longtext':
                 if ($field_type == 'varchar' && $field['length'] < 255) {
                     $html_type = "input";
                 } elseif ($field_type == 'varchar' && $field['length'] < 3000) {
                     $html_type = "textarea";
                 } else {
                     $html_type = "html";
                 }
                 break;
             case 'enum':
                 $html_type = "radio";
                 break;
             case 'date':
             case 'datetime':
                 $html_type = "date";
                 break;
             default:
                 $html_type = "input";
         }
     }
     // No data provided
     if (!is_array($data)) {
         $data = array();
         // Try to get the ENUM possible values
         if ($field_type == 'enum') {
             foreach ($field['length'] as $enum) {
                 $data[$enum] = $enum;
             }
         }
     }
     switch ($html_type) {
         // Select
         // $data is supposed to be an array of keys => displayed labels
         case 'select':
             $extra .= ' class="select"';
             return form_dropdown($field_name, $data, $field_value, $extra);
             break;
         case 'multiselect':
             $extra .= ' class="select multiselect"';
             $selected = explode(',', $field_value);
             $field_name = $field_name . '[]';
             return form_multiselect($field_name, $data, $selected, $extra);
             break;
         case 'input':
             $extra .= ' class="inputtext"';
             return form_input($field_name, $field_value, $extra);
             break;
         case 'textarea':
             $extra .= ' class="textarea"';
             return form_textarea($field_name, $field_value, $extra);
             break;
             // Text Editing textarea (tinyMCE in this case)
         // Text Editing textarea (tinyMCE in this case)
         case 'html':
             $extra .= ' class="tinyTextarea"';
             return form_textarea($field_name, $field_value, $extra);
             break;
         case 'checkbox':
             $extra = ' class="checkbox"';
             $str = '';
             $print_label = TRUE;
             // We consider the checkbox only validate one data, which should be set at 1 or 0.
             if (empty($data)) {
                 $data = array(1 => '');
                 $print_label = FALSE;
             }
             foreach ($data as $value => $label) {
                 $id = 'c_' . uniqid();
                 $extra2 = $extra . ' id="' . $id . '"';
                 $checked = $field_value == $value ? TRUE : FALSE;
                 if ($print_label === TRUE) {
                     $str .= form_label($label, $id);
                 }
                 $str .= form_checkbox($field_name, $value, $checked, $extra2);
             }
             return $str;
             break;
         case 'radio':
             $extra = ' class="radio"';
             $str = '';
             $print_label = TRUE;
             // We consider the checkbox only validate one data, which should be set at 1 or 0.
             if (empty($data)) {
                 $data = array(1 => '');
                 $print_label = FALSE;
             }
             foreach ($data as $value => $label) {
                 $id = 'r_' . uniqid();
                 $extra2 = $extra . ' id="' . $id . '"';
                 $checked = $field_value == $value ? TRUE : FALSE;
                 if ($print_label === TRUE) {
                     $str .= form_label($label, $id);
                 }
                 $str .= form_radio($field_name, $value, $checked, $extra2);
             }
             return $str;
             break;
         case 'date':
             $extra .= ' class="inputtext date"';
             if ($field['type'] == 'datetime') {
                 $field_value = humanize_mdate($field_value, Settings::get('date_format') . ' %H:%i:%s');
             } else {
                 $field_value = humanize_mdate($field_value, Settings::get('date_format'));
             }
             return form_input($field_name, $field_value, $extra);
             break;
         default:
             $extra .= ' class="inputtext"';
             return form_input($field_name, $field_value, $extra);
     }
 }
Exemple #2
0
?>
" />
					<a class="icon clearfield date" data-id="publish_on"></a>
				</dd>
			</dl>

			<dl class="small last">
				<dt>
					<label for="publish_off"><?php 
echo lang('ionize_label_publish_off');
?>
</label>
				</dt>
				<dd>
					<input id="publish_off" name="publish_off" type="text" class="inputtext w120 date"  value="<?php 
echo humanize_mdate($publish_off, Settings::get('date_format') . ' %H:%i:%s');
?>
" />
					<a class="icon clearfield date" data-id="publish_off"></a>
				</dd>
			</dl>

		</div>

		<!-- Permissions -->
		<?php 
if (Authority::can('access', 'admin/article/permissions')) {
    ?>
			<h3 class="toggler toggler-options"><?php 
    echo lang('ionize_title_permissions');
    ?>
Exemple #3
0
				<!-- Date -->
				<dl class="small">
					<dt><label for="date_<?php 
echo $type . $id_media;
?>
"><?php 
echo lang('ionize_label_date');
?>
</label></dt>
					<dd>
						<input id="date_<?php 
echo $type . $id_media;
?>
" name="date" type="text" class="inputtext date" value="<?php 
echo humanize_mdate($date, Settings::get('date_format') . ' %H:%i:%s');
?>
" />
						<a class="icon clearfield date" data-id="date_<?php 
echo $type . $id_media;
?>
"></a>
					</dd>
				</dl>

			</div>
		</div>
	</fieldset>
</form>

<div class="buttons">
Exemple #4
0
									<td>
										<a title="<?php 
            echo lang('ionize_label_edit');
            ?>
" data-id="<?php 
            echo $page['id_page'];
            ?>
" class="page">
											<span class="icon edit mr5 left"></span>
											<?php 
            echo $title;
            ?>
										</a>
									</td>
									<td><?php 
            echo humanize_mdate($page['updated'], Settings::get('date_format') . ' %H:%i');
            ?>
</td>
								</tr>

							<?php 
        }
        ?>

							</tbody>
						</table>
					</div>
				<?php 
    }
    ?>
			</div>
Exemple #5
0
}
?>
  />
			</dd>
		</dl>

		<dl class="small last">
			<dt>
				<label for="comment_expire"><?php 
echo lang('ionize_label_comment_expire');
?>
</label>
			</dt>
			<dd>
				<input id="comment_expire" name="comment_expire" type="text" class="inputtext w120 date"  value="<?php 
echo humanize_mdate($comment_expire, Settings::get('date_format') . ' %H:%i:%s');
?>
" />
			</dd>
		</dl>

	</div>
	
	-->


	<!-- Copy Content -->
	<?php 
if (!empty($id_article)) {
    ?>
Exemple #6
0
													<?php 
                                $i++;
                            }
                            ?>
										<?php 
                        }
                        ?>

										<!-- Date & Time -->
										<?php 
                        if ($field['type'] == '7') {
                            ?>

											<?php 
                            echo humanize_mdate($field[$lang]['content'], Settings::get('date_format') . ' %H:%i:%s');
                            ?>

										<?php 
                        }
                        ?>

									<?php 
                    }
                    ?>
									</div>

								</div>

								<?php 
                }
</td>
					<td><a><?php 
        echo $user['username'];
        ?>
</a></td>
					<td><?php 
        echo $user['screen_name'];
        ?>
</td>
					<td><?php 
        echo $user['role_name'];
        ?>
</td>
					<td>
						<?php 
        echo humanize_mdate($user['join_date'], Settings::get('date_format'));
        ?>
					</td>
                    <td>
                        <a class="icon mail" data-email="<?php 
        echo $user['email'];
        ?>
"></a>
                    </td>
					<td>
						<?php 
        if (User()->getId() != $user['id_user'] && Authority::can('delete', 'admin/user')) {
            ?>
							<a class="icon delete" data-id="<?php 
            echo $user['id_user'];
            ?>
        ?>
</a></td>
						<td><?php 
        echo $article['author'];
        ?>
</td>
						<td><?php 
        echo $article['updater'];
        ?>
</td>
						<td><?php 
        echo humanize_mdate($article['created'], Settings::get('date_format') . ' %H:%i:%s');
        ?>
</td>
						<td><?php 
        echo humanize_mdate($article['updated'], Settings::get('date_format') . ' %H:%i:%s');
        ?>
</td>
					</tr>
			
				<?php 
    }
    ?>
				
				</tbody>
			
			</table>

		</div>

		<?php